1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

change docker

This commit is contained in:
MoonTestUse1
2024-12-24 00:00:18 +06:00
parent 36219ba7dd
commit baaf9afc84
2 changed files with 19 additions and 19 deletions

View File

@@ -3,20 +3,17 @@ version: '3.8'
services: services:
frontend: frontend:
build: build:
context: ./frontend context: .
dockerfile: ../docker/frontend/Dockerfile dockerfile: docker/frontend/Dockerfile
container_name: support-frontend container_name: support-frontend
restart: unless-stopped restart: unless-stopped
volumes:
- ./frontend:/app
- /app/node_modules
depends_on: depends_on:
- backend - backend
backend: backend:
build: build:
context: ./backend context: .
dockerfile: ../docker/backend/Dockerfile dockerfile: docker/backend/Dockerfile
container_name: support-backend container_name: support-backend
restart: unless-stopped restart: unless-stopped
environment: environment:
@@ -27,15 +24,13 @@ services:
- sqlite_data:/app/instance - sqlite_data:/app/instance
nginx: nginx:
image: nginx:alpine build:
context: .
dockerfile: docker/frontend/Dockerfile
container_name: support-nginx container_name: support-nginx
restart: unless-stopped restart: unless-stopped
ports: ports:
- "80:80" - "80:80"
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
- ./frontend/dist:/usr/share/nginx/html:ro
depends_on: depends_on:
- frontend - frontend
- backend - backend

View File

@@ -1,22 +1,21 @@
# docker/nginx/conf.d/default.conf # docker/nginx/conf.d/default.conf
upstream backend { upstream backend {
server backend:8000; # Changed port to match FastAPI default server backend:8000;
} }
server { server {
listen 80; listen 80;
server_name localhost; server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Handle frontend routes
location / { location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache";
# Disable caching for index.html
add_header Cache-Control "no-store, no-cache, must-revalidate";
} }
# Proxy API requests to backend
location /api/ { location /api/ {
proxy_pass http://backend/; proxy_pass http://backend/;
proxy_http_version 1.1; proxy_http_version 1.1;
@@ -28,4 +27,10 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }
# Handle favicon.ico
location = /favicon.ico {
access_log off;
log_not_found off;
}
} }