From 91d8b79e58c9417b37e2ec643e88bb8bf3f7440e Mon Sep 17 00:00:00 2001 From: dragongoose Date: Mon, 19 Feb 2024 11:21:00 -0500 Subject: [PATCH] docker fixes --- docker/.dockerignore => .dockerignore | 0 docker/Dockerfile | 10 +++++--- docker/docker-compose.build.yml | 35 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) rename docker/.dockerignore => .dockerignore (100%) create mode 100644 docker/docker-compose.build.yml diff --git a/docker/.dockerignore b/.dockerignore similarity index 100% rename from docker/.dockerignore rename to .dockerignore diff --git a/docker/Dockerfile b/docker/Dockerfile index 1060ff0..8eadfd6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,14 +16,18 @@ ENV SAFETWITCH_HTTPS SAFETWITCH_HTTPS_PLACEHOLDER ENV SAFETWITCH_DEFAULT_LOCALE SAFETWITCH_DEFAULT_LOCALE_PLACEHOLDER ENV SAFETWITCH_FALLBACK_LOCALE SAFETWITCH_FALLBACK_LOCALE_PLACEHOLDER ENV SAFETWITCH_DEFAULT_THEME SAFETWITCH_DEFAULT_THEME_PLACEHOLDER + + # Copy all files from current directory to working dir in image -COPY ../ . +COPY ./ . + +RUN ls # install node modules and build assets RUN npm i && npm run build # nginx state for serving content FROM docker.io/nginx:alpine -COPY ./nginx.conf /etc/nginx/nginx.conf +COPY ./docker/nginx.conf /etc/nginx/nginx.conf # Set working directory to nginx asset directory RUN mkdir /app # Copy static assets from builder stage @@ -32,6 +36,6 @@ COPY --from=builder /app/dist /app EXPOSE 8280 # Overriding the default NGINX container behavior -COPY ./substitute_environment_variables.sh ./substitute_environment_variables.sh +COPY ./docker/substitute_environment_variables.sh ./substitute_environment_variables.sh RUN chmod +x /substitute_environment_variables.sh ENTRYPOINT ["/substitute_environment_variables.sh"] \ No newline at end of file diff --git a/docker/docker-compose.build.yml b/docker/docker-compose.build.yml new file mode 100644 index 0000000..db37d33 --- /dev/null +++ b/docker/docker-compose.build.yml @@ -0,0 +1,35 @@ +version: "3.7" + +services: + safetwitch-frontend: + container_name: safetwitch-frontend + hostname: safetwitch-frontend + restart: always + build: + context: "../" + dockerfile: "./docker/Dockerfile" + ports: + - "127.0.0.1:8280:8280" + environment: + - SAFETWITCH_BACKEND_DOMAIN=localhost:7100 + - SAFETWITCH_INSTANCE_DOMAIN=localhost:8280 + - SAFETWITCH_HTTPS=true + - SAFETWITCH_DEFAULT_THEME=dark + - SAFETWITCH_DEFAULT_LOCALE=en-US + - SAFETWITCH_FALLBACK_LOCALE=en-US + + safetwitch-backend: + container_name: safetwitch-backend + hostname: safetwitch-backend + read_only: true + security_opt: + - no-new-privileges:true + cap_drop: + - ALL + restart: always + image: codeberg.org/safetwitch/safetwitch-backend:latest + ports: + - "127.0.0.1:7100:7000" + environment: + - PORT=7000 + - URL=changeme \ No newline at end of file