# Use the Debian base image FROM debian:stable-slim # Set environment variables to prevent interactive prompts during apt operations ENV DEBIAN_FRONTEND=noninteractive # Install necessary packages: # git: for cloning and updating the repository # libmojolicious-perl, libdbi-perl, libfile-slurp-perl, libdbd-sqlite3-perl: Perl modules required by KISSmo Perl # ca-certificates: essential for SSL certificate verification during git clone # cron: for scheduling periodic updates and restarts RUN apt update && \ apt install -y --no-install-recommends \ git \ libmojolicious-perl \ libdbi-perl \ libfile-slurp-perl \ libdbd-sqlite3-perl \ ca-certificates \ cron && \ # Ensure CA certificates are up-to-date update-ca-certificates && \ # Clean up apt cache to reduce image size rm -rf /var/lib/apt/lists/* # Clone the KISSmo Perl repository into the /app directory RUN git clone https://git.hax.al/KISSmoPerl/ /app # Set the working directory for subsequent commands WORKDIR /app # Create the SQLite database file and the 'pastes' directory # These are required by the KISSmo Perl application for data storage RUN touch pastes.db && mkdir pastes # Copy the update script into the container and make it executable # This script will handle git pull and restarting the perl application COPY update_kissmo.sh /usr/local/bin/update_kissmo.sh RUN chmod +x /usr/local/bin/update_kissmo.sh # Add the cron job to run the update script # The job is scheduled to run at midnight (00:00) on the 1st and 21st day of every month. # Output from the script will be logged to /var/log/cron.log RUN (crontab -l 2>/dev/null; echo "0 0 1,21 * * /usr/local/bin/update_kissmo.sh >> /var/log/cron.log 2>&1") | crontab - # Copy the entrypoint script and make it executable COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh # Expose port 7878, which is the port KISSmo Perl listens on EXPOSE 7878 # Use the exec form for CMD, pointing to the entrypoint script CMD ["/usr/local/bin/entrypoint.sh"]