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-23 23:34:41 +06:00
parent ae3e0a1f0a
commit 4c3c1bfc6d
4 changed files with 16 additions and 23 deletions

View File

@@ -1,19 +1,13 @@
FROM node:18-alpine as builder
# docker/frontend/Dockerfile
FROM node:18-alpine as build
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy source code
COPY . .
# Build the app
RUN npm run build
# Production stage
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=build /app/dist /usr/share/nginx/html

View File

@@ -1,5 +1,6 @@
# docker/nginx/conf.d/default.conf
upstream backend {
server backend:8000; # Changed from 8080 to match FastAPI port
server backend:8000; # Change port to match FastAPI default
}
server {
@@ -9,14 +10,15 @@ server {
root /usr/share/nginx/html;
index index.html;
# Fix permissions and routing
# Handle SPA routing
location / {
try_files $uri $uri/ /index.html =404;
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache";
}
# Proxy API requests
location /api/ {
proxy_pass http://backend/api/;
proxy_pass http://backend/; # Remove /api/ from proxy_pass
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -27,7 +29,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
# Add explicit favicon handling
# Handle favicon
location = /favicon.ico {
access_log off;
log_not_found off;