aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorArianit K <arianit@hax.al>2025-06-03 00:16:37 +0000
committerArianit K <arianit@hax.al>2025-06-03 00:16:37 +0000
commit9d7f9d6253717dc5f87d674c1cc49f53256d9485 (patch)
tree8ab3b154b462e696ce2ab34fb00af622e23365be /Dockerfile
downloadKISSmoDocker-9d7f9d6253717dc5f87d674c1cc49f53256d9485.tar.gz
KISSmoDocker-9d7f9d6253717dc5f87d674c1cc49f53256d9485.zip
KISSmo Docker
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile54
1 files changed, 54 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..258d7f8
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,54 @@
+# 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"]