1 # Use the Debian base image 2 FROM debian:stable-slim 3 4 # Set environment variables to prevent interactive prompts during apt operations 5 ENV DEBIAN_FRONTEND=noninteractive 6 7 # Install necessary packages: 8 # git: for cloning and updating the repository 9 # libmojolicious-perl, libdbi-perl, libfile-slurp-perl, libdbd-sqlite3-perl: Perl modules required by KISSmo Perl 10 # ca-certificates: essential for SSL certificate verification during git clone 11 # cron: for scheduling periodic updates and restarts 12 RUN apt update && \ 13 apt install -y --no-install-recommends \ 14 git \ 15 libmojolicious-perl \ 16 libdbi-perl \ 17 libfile-slurp-perl \ 18 libdbd-sqlite3-perl \ 19 ca-certificates \ 20 cron && \ 21 # Ensure CA certificates are up-to-date 22 update-ca-certificates && \ 23 # Clean up apt cache to reduce image size 24 rm -rf /var/lib/apt/lists/* 25 26 # Clone the KISSmo Perl repository into the /app directory 27 RUN git clone https://git.hax.al/KISSmoPerl/ /app 28 29 # Set the working directory for subsequent commands 30 WORKDIR /app 31 32 # Create the SQLite database file and the 'pastes' directory 33 # These are required by the KISSmo Perl application for data storage 34 RUN touch pastes.db && mkdir pastes 35 36 # Copy the update script into the container and make it executable 37 # This script will handle git pull and restarting the perl application 38 COPY update_kissmo.sh /usr/local/bin/update_kissmo.sh 39 RUN chmod +x /usr/local/bin/update_kissmo.sh 40 41 # Add the cron job to run the update script 42 # The job is scheduled to run at midnight (00:00) on the 1st and 21st day of every month. 43 # Output from the script will be logged to /var/log/cron.log 44 RUN (crontab -l 2>/dev/null; echo "0 0 1,21 * * /usr/local/bin/update_kissmo.sh >> /var/log/cron.log 2>&1") | crontab - 45 46 # Copy the entrypoint script and make it executable 47 COPY entrypoint.sh /usr/local/bin/entrypoint.sh 48 RUN chmod +x /usr/local/bin/entrypoint.sh 49 50 # Expose port 7878, which is the port KISSmo Perl listens on 51 EXPOSE 7878 52 53 # Use the exec form for CMD, pointing to the entrypoint script 54 CMD ["/usr/local/bin/entrypoint.sh"]