51f712f602
- Dockerfile: node:22-slim stage runs npm ci + npm run build; python runtime stage COPY --from copies dist to /app/frontend/dist (matches SPA_DIST_DIR); runtime image has no node - .dockerignore: exclude frontend/node_modules and frontend/dist from context - .github/workflows/frontend.yml: npm ci + codegen-sync + lint/typecheck/test/build - tests/test_deployment.py: skip COPY --from sources in the context-existence check; assert the multi-stage frontend build wiring - verified with a real docker build (image serves SPA, no node at runtime)
38 lines
795 B
Docker
38 lines
795 B
Docker
# Stage 1: build the React SPA
|
|
FROM node:22-slim AS frontend-build
|
|
|
|
WORKDIR /frontend
|
|
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: python runtime (no node)
|
|
FROM python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY app ./app
|
|
COPY alembic_app ./alembic_app
|
|
COPY alembic_app.ini ./
|
|
COPY scripts ./scripts
|
|
COPY docker ./docker
|
|
COPY README.md ./
|
|
RUN mkdir -p /app/data
|
|
|
|
# Copy the built SPA dist from the frontend-build stage
|
|
COPY --from=frontend-build /frontend/dist ./frontend/dist
|
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["/app/docker/entrypoint.sh"]
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|