From 16f920d0b450cbc0e23e0b9c2f041bb0e1b461ea Mon Sep 17 00:00:00 2001 From: Fascinated Date: Tue, 4 Jul 2023 16:46:10 +0100 Subject: [PATCH] maybe fix docker? --- Dockerfile | 10 ++++++---- {conf => docker}/nginx.conf | 4 +++- docker/start.sh | 13 +++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) rename {conf => docker}/nginx.conf (85%) create mode 100644 docker/start.sh diff --git a/Dockerfile b/Dockerfile index 8204bd7..3d86c7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,11 @@ RUN DEBIAN_FRONTEND=noninteractive \ apt install nginx php-fpm php-gd -y # Set up nginx -COPY ./conf/nginx.conf /etc/nginx/nginx.conf +COPY ./docker/nginx.conf /etc/nginx/nginx.conf RUN mkdir -p /var/www/html -COPY ./upload.php /var/www/html/index.php -# Start NGINX -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +# Setup scripts +COPY ./docker/start.sh /start.sh + +# Start server +CMD ["bash", "/start.sh"] \ No newline at end of file diff --git a/conf/nginx.conf b/docker/nginx.conf similarity index 85% rename from conf/nginx.conf rename to docker/nginx.conf index a9cc780..ab88d5d 100644 --- a/conf/nginx.conf +++ b/docker/nginx.conf @@ -3,6 +3,8 @@ events { } http { + access_log /dev/stdout; + server { server_name _; listen 80; @@ -13,7 +15,7 @@ http { gzip_proxied any; gzip_comp_level 8; gzip_buffers 16 64k; - gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; root /var/www/html; index index.html index.htm; diff --git a/docker/start.sh b/docker/start.sh new file mode 100644 index 0000000..7f56d52 --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,13 @@ +UPLOAD_SCRIPT="upload.php" + +echo "Checking if $UPLOAD_SCRIPT exists in /var/www/html" +if [ -f "$UPLOAD_SCRIPT" ]; then + echo "$FILE exists, not copying" +else + cp /var/www/html/$UPLOAD_SCRIPT $UPLOAD_SCRIPT + echo "$UPLOAD_SCRIPT copied to /var/www/html/$UPLOAD_SCRIPT" +fi + +# Start Nginx +echo "Starting Nginx" +nginx -g "daemon off;" \ No newline at end of file