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.
41 lines
1.6 KiB
Docker
41 lines
1.6 KiB
Docker
# SET50 alternative-data platform - single-container image.
|
|
# Serves: built Vue SPA (frontend/dist) via nginx, proxying /api to the
|
|
# Flask backend (127.0.0.1:5000). Data persists under /app/backend/data
|
|
# (mount a volume there or set DATA_DIR to a mounted path).
|
|
#
|
|
# Build strategy: PREBUILT frontend dist (no node/npm/vite in this image) —
|
|
# build with `cd frontend && npm run build` and commit frontend/dist/.
|
|
FROM python:3.11-slim
|
|
|
|
# nginx for serving the SPA
|
|
RUN apt-get update && apt-get install -y --no-install-recommends nginx \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& rm -f /etc/nginx/sites-enabled/default /etc/nginx/conf.d/default.conf 2>/dev/null || true
|
|
|
|
WORKDIR /app
|
|
|
|
# 1) frontend static (prebuilt) — must exist on-disk (committed)
|
|
COPY frontend/dist/ ./frontend/dist/
|
|
|
|
# 2) backend deps + code
|
|
COPY backend/requirements.txt ./backend/requirements.txt
|
|
RUN pip install --no-cache-dir -r backend/requirements.txt
|
|
COPY backend/ ./backend/
|
|
|
|
# 3) deploy config (nginx conf + entrypoint)
|
|
COPY deploy/nginx.conf /etc/nginx/conf.d/set50.conf
|
|
COPY deploy/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
# persistent data (factor vintages, dividend ledger, forward runs, prices)
|
|
ENV DATA_DIR=/app/backend/data
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=5000
|
|
VOLUME ["/app/backend/data"]
|
|
|
|
EXPOSE 80
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1/api/v1/dashboard/summary', timeout=4).status==200 else 1)"
|
|
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|