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:
frontend:
build:
context: ./frontend
dockerfile: ../docker/frontend/Dockerfile
context: .
dockerfile: docker/frontend/Dockerfile
container_name: support-frontend
restart: unless-stopped
volumes:
- ./frontend:/app
- /app/node_modules
depends_on:
- backend
backend:
build:
context: ./backend
dockerfile: ../docker/backend/Dockerfile
context: .
dockerfile: docker/backend/Dockerfile
container_name: support-backend
restart: unless-stopped
environment:
@@ -27,15 +24,13 @@ services:
- sqlite_data:/app/instance
nginx:
image: nginx:alpine
build:
context: .
dockerfile: docker/frontend/Dockerfile
container_name: support-nginx
restart: unless-stopped
ports:
- "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:
- frontend
- backend

View File

@@ -1,22 +1,21 @@
# docker/nginx/conf.d/default.conf
upstream backend {
server backend:8000; # Changed port to match FastAPI default
server backend:8000;
}
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Handle frontend routes
location / {
root /usr/share/nginx/html;
index 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/ {
proxy_pass http://backend/;
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-Proto $scheme;
}
# Handle favicon.ico
location = /favicon.ico {
access_log off;
log_not_found off;
}
}