From df6b70a365f792a4356a706df4ba3b12cb7c1ea1 Mon Sep 17 00:00:00 2001 From: thealhu Date: Thu, 27 Jun 2024 19:25:35 +0200 Subject: [PATCH 1/2] Add a Dockerfile for future Docker support --- docker/Dockerfile | 25 +++++++++++++++++++++++++ docker/configini.sh | 4 ++++ docker/docker-compose.yaml | 7 +++++++ 3 files changed, 36 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/configini.sh create mode 100644 docker/docker-compose.yaml diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..535b71d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,25 @@ +FROM alpine:latest + +# Install required packages +RUN apk add --update --no-cache git python3 py3-pip + +# Clone the repository +RUN git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git + +# Install Python dependencies +RUN pip install --no-cache-dir --break-system-packages -r /TC2-BBS-mesh/requirements.txt + +# Copy configuration script +COPY configini.sh / + +# Set permissions for configuration script +RUN chmod +x /configini.sh + +# Define config volume +VOLUME /config + +# Define working directory +WORKDIR /config + +# Define the command to run +CMD ["sh", "-c", " /configini.sh && python3 /TC2-BBS-mesh/server.py"] \ No newline at end of file diff --git a/docker/configini.sh b/docker/configini.sh new file mode 100644 index 0000000..0bf4a4d --- /dev/null +++ b/docker/configini.sh @@ -0,0 +1,4 @@ +#!/bin/sh +if [ ! -f "/config/config.ini" ]; then + cp "/TC2-BBS-mesh/config.ini" "/config/config.ini" +fi \ No newline at end of file diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 0000000..88266b0 --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + tc2-bbs-mesh: + build: . + restart: always + volumes: + - ./config:/config + container_name: tc2-bbs-mesh \ No newline at end of file From 55562502abd8500ddc6007b2310ca67c8af7f4ff Mon Sep 17 00:00:00 2001 From: thealhu Date: Thu, 27 Jun 2024 20:18:47 +0200 Subject: [PATCH 2/2] add fortunes.txt check for docker --- docker/configini.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/configini.sh b/docker/configini.sh index 0bf4a4d..631fc98 100644 --- a/docker/configini.sh +++ b/docker/configini.sh @@ -1,4 +1,7 @@ #!/bin/sh if [ ! -f "/config/config.ini" ]; then cp "/TC2-BBS-mesh/config.ini" "/config/config.ini" +fi +if [ ! -f "/config/fortunes.txt" ]; then + cp "/TC2-BBS-mesh/fortunes.txt" "/config/fortunes.txt" fi \ No newline at end of file