rebase
This commit is contained in:
@@ -13,10 +13,10 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
# Create data directory
|
||||
# Create data directory for assets / uploads
|
||||
RUN mkdir -p /app/data/assets
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Default: run uvicorn; in dev override with `npm run dev` equivalent
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||
# Default: run uvicorn. In dev override via docker-compose volumes for hot reload.
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
@@ -1,14 +1,32 @@
|
||||
# Build stage
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Bake the API base URL into the Vite bundle at build time.
|
||||
# Default is the relative "/api" — works when the app is served from the same
|
||||
# origin as the /api reverse proxy (nginx in front of the backend).
|
||||
ARG VITE_API_BASE_URL=/api
|
||||
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
|
||||
|
||||
# Copy frontend manifest first for better layer caching
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the frontend source and build
|
||||
COPY frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
# Serve stage
|
||||
# -------------------------------------------------------------------
|
||||
# Serve stage — nginx
|
||||
# -------------------------------------------------------------------
|
||||
FROM nginx:1.24-alpine
|
||||
|
||||
# Copy built static assets from the build stage
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
# Copy nginx config (path is relative to the build context, which is the project root)
|
||||
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
@@ -5,12 +5,17 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# SPA fallback
|
||||
# Gzip for text assets
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
||||
gzip_min_length 1024;
|
||||
|
||||
# SPA fallback — must be before /api/ location
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# API + SSE
|
||||
# API + SSE — proxy to backend container
|
||||
location /api/ {
|
||||
proxy_pass http://backend:8000;
|
||||
proxy_http_version 1.1;
|
||||
@@ -19,14 +24,27 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# SSE: disable buffering
|
||||
# SSE: disable buffering, extend timeouts for long-running streams
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
|
||||
# WebSocket support (in case of future upgrade)
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
# Static assets (icons, uploads)
|
||||
# Static assets (icons, uploads) served by backend
|
||||
location /static/ {
|
||||
proxy_pass http://backend:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
# Health-check passthrough
|
||||
location = /health {
|
||||
proxy_pass http://backend:8000/api/health;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user