From 601a68bf10cf5ccd65e835c85a6415f4b14e48ed Mon Sep 17 00:00:00 2001 From: MoonTestUse1 Date: Wed, 25 Dec 2024 23:14:35 +0600 Subject: [PATCH] 23:14 --- docker/frontend/Dockerfile | 12 +++--------- docker/nginx/conf.d/default.conf | 15 ++------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/docker/frontend/Dockerfile b/docker/frontend/Dockerfile index 34dcb50..602f492 100644 --- a/docker/frontend/Dockerfile +++ b/docker/frontend/Dockerfile @@ -18,15 +18,9 @@ FROM nginx:alpine RUN rm -rf /usr/share/nginx/html/* # Copy static assets from builder stage -COPY --from=build /app/dist /usr/share/nginx/html - -# Copy nginx configuration -COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf - -# Ensure correct permissions -RUN chown -R nginx:nginx /usr/share/nginx/html && \ - chmod -R 755 /usr/share/nginx/html +COPY --from=build /app/dist/ /usr/share/nginx/html/ +# Expose port EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf index 41731ad..9d88da1 100644 --- a/docker/nginx/conf.d/default.conf +++ b/docker/nginx/conf.d/default.conf @@ -1,33 +1,22 @@ server { listen 80; server_name 185.139.70.62; - + root /usr/share/nginx/html; index index.html; - - # Основной location для SPA + location / { try_files $uri $uri/ /index.html; - add_header Cache-Control "no-cache"; } - # API requests location /api/ { proxy_pass http://backend:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } - - # Static files - location /assets/ { - alias /usr/share/nginx/html/assets/; - expires 1y; - add_header Cache-Control "public, no-transform"; - } }