From c8b4674f9cfde7a320a4efb7b37b895593b8a9ba Mon Sep 17 00:00:00 2001 From: Daan Date: Thu, 21 Nov 2024 14:14:55 +0100 Subject: [PATCH] Added docker container persistence using volume at /data --- Dockerfile | 11 ++++++----- docker/compose.yaml | 12 ++++++++++++ entrypoint.sh | 11 ++++++++++- 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 docker/compose.yaml diff --git a/Dockerfile b/Dockerfile index 5b1642b..84984e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,15 @@ FROM alpine:latest LABEL maintainer="dselen@nerthus.nl" # Install Apache & Bash -RUN apk update && apk add --no-cache apache2 bash +RUN apk update \ + && apk add --no-cache apache2 bash # Suppress the ServerName warning -RUN echo "ServerName localhost" >> /etc/apache2/httpd.conf +RUN echo "ServerName localhost" >> /etc/apache2/httpd.conf \ + && mkdir /app \ + && mkdir /data COPY entrypoint.sh /entrypoint.sh -COPY ntos /var/www/localhost/htdocs/ - -EXPOSE 80 +COPY ntos /app ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] \ No newline at end of file diff --git a/docker/compose.yaml b/docker/compose.yaml new file mode 100644 index 0000000..a7a5fcf --- /dev/null +++ b/docker/compose.yaml @@ -0,0 +1,12 @@ +services: + ntos-server: + image: test:latest + #image: dselen/ntos-server:latest + container_name: ntos-server + restart: unless-stopped + ports: + - 8080:80/tcp + volumes: + - ntos_data:/data +volumes: + ntos_data: diff --git a/entrypoint.sh b/entrypoint.sh index 98f6c14..7b0c7c0 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,15 @@ #!/bin/bash -echo "Starting NTOS-Server..." +echo "Configuring NTOS-Server..." + +cp -rv /app/* /data + +ln -s /data/assets /var/www/localhost/htdocs/assets +ln -s /data/configs /var/www/localhost/htdocs/configs +ln -s /data/credcon /var/www/localhost/htdocs/credcon +ln -s /data/rdp /var/www/localhost/htdocs/rdp + +echo "Done. Starting Apache2 webserver..." httpd -D FOREGROUND &