feat: Docker deploy serving SPA and API on :8080

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
肉末
2026-07-14 13:03:51 +08:00
parent 600c536367
commit 7c2489ea5c
5 changed files with 149 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
# Stage 1 — build Vue SPA
FROM node:20 AS frontend-build
WORKDIR /frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# Stage 2 — FastAPI + built SPA
FROM python:3.12-slim
WORKDIR /app
ENV DATA_DIR=/data \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY backend/app ./app
COPY --from=frontend-build /frontend/dist ./frontend/dist
EXPOSE 8080
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]