The Vue SPA is now built locally and its frontend/dist/ committed (force-added). Dockerfile is a single-stage runtime: copy prebuilt dist + python:3.11 + Flask. No node/npm inside the image -> deterministic, no npm/esbuild postinstall flakiness. To update UI: edit src, npm run build, commit frontend/dist/.
34 lines
1.1 KiB
Docker
34 lines
1.1 KiB
Docker
# Sales Trainer — single-container runtime (Python 3.11 + Flask)
|
|
#
|
|
# The Vue frontend is BUILT LOCALLY (`cd frontend && npm run build`) and the
|
|
# resulting `frontend/dist/` is committed to the repo. This image does NOT run
|
|
# npm/node at all — it just copies the prebuilt SPA and serves it via Flask.
|
|
# This eliminates `vite: not found` / npm postinstall flakiness from the build.
|
|
#
|
|
# To update the UI: edit frontend/src, run `npm run build` locally, commit dist/.
|
|
|
|
FROM python:3.11-slim
|
|
|
|
# Runtime deps (none required beyond Python + pip packages; curl for healthcheck)
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends curl ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# 1) Copy prebuilt frontend SPA (built locally, committed to repo)
|
|
COPY frontend/dist/ ./frontend/dist/
|
|
|
|
# 2) Install backend deps
|
|
COPY backend/requirements.txt ./backend/
|
|
RUN pip install --no-cache-dir -r backend/requirements.txt
|
|
|
|
# 3) Copy backend source (and stub frontend dir so static serving finds dist)
|
|
COPY backend/ ./backend/
|
|
|
|
# Run
|
|
WORKDIR /app/backend
|
|
ENV FLASK_DEBUG=0
|
|
EXPOSE 5001
|
|
CMD ["python", "run.py"]
|