From 572a393440b39a838b99227ba2222a210a495fac Mon Sep 17 00:00:00 2001 From: IwanIDev Date: Wed, 4 Mar 2026 17:47:43 +0000 Subject: Refactor Docker setup: replace inline Nginx configuration with external file and update Docker stack port configuration --- Dockerfile | 13 +------------ docker-stack.yml | 7 +++++-- nginx.conf | 11 +++++++++++ 3 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 3530ae0..8cd785f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,18 +13,7 @@ RUN bun run build FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html -COPY <<'EOF' /etc/nginx/conf.d/default.conf -server { - listen 80; - server_name _; - root /usr/share/nginx/html; - index index.html; - - location / { - try_files $uri $uri/ /index.html; - } -} -EOF +COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-stack.yml b/docker-stack.yml index 9b10293..730e730 100644 --- a/docker-stack.yml +++ b/docker-stack.yml @@ -4,9 +4,12 @@ services: web: image: ${IMAGE_NAME} ports: - - "8280:80" + - target: 80 + published: 8280 + protocol: tcp + mode: host deploy: - replicas: 2 + replicas: 1 update_config: parallelism: 1 delay: 10s diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..483d49c --- /dev/null +++ b/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + listen [::]:80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +} -- cgit