Add self-contained Docker deployment for EasyPanel / docker-compose: - Dockerfile: python:3.11-slim + nginx. Serves the PREBUILT Vue SPA (frontend/dist, committed) via nginx and reverse-proxies /api to the Flask backend on 127.0.0.1:5000. No node/npm in the image (avoids Vite/npm flakiness in Docker builds). VOLUME /app/backend/data for persistence (factor vintages, dividend ledger, forward runs, prices). HEALTHCHECK hits /api/v1/dashboard/summary. Exposes :80. - deploy/nginx.conf: SPA fallback + /api proxy to 127.0.0.1:5000 + gzip. - deploy/entrypoint.sh: starts Flask (HOST=0.0.0.0:5000) + nginx foreground, forwards signals. - docker-compose.yml: single service 'set50', port 8080:80, mounts ./backend/data for persistence, healthcheck. - .dockerignore excludes .git/.venv/backend/data/node_modules/docs. - .gitignore now tracks frontend/dist/ (prebuilt bundle required by the image); backend/data stays untracked. - Backend runtime verified: test_client GET /api/v1/dashboard/summary=200 (the HEALTHCHECK path). entrypoint sh -n, compose YAML parse, and all Dockerfile-referenced files exist. NOTE: no local docker here, so the image itself was not built — that happens on EasyPanel.
30 lines
824 B
Nginx Configuration File
30 lines
824 B
Nginx Configuration File
# nginx: serve the built Vue SPA + reverse-proxy /api to the Flask backend.
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /app/frontend/dist;
|
|
index index.html;
|
|
|
|
# SPA fallback: any non-API GET that isn't a real file -> index.html
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# API traffic goes to the Flask backend on 127.0.0.1:5000
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:5000;
|
|
proxy_set_header Host $host;
|
|
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;
|
|
proxy_read_timeout 120s;
|
|
}
|
|
|
|
# never serve dotfiles
|
|
location ~ /\. { deny all; }
|
|
|
|
gzip on;
|
|
gzip_types text/css application/javascript application/json;
|
|
}
|