32 lines
675 B
Docker
32 lines
675 B
Docker
# ---- Stage 1: Build frontend ----
|
|
FROM node:20-alpine AS frontend-build
|
|
WORKDIR /frontend
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci
|
|
COPY frontend/ .
|
|
RUN npm run build
|
|
|
|
# ---- Stage 2: Python backend ----
|
|
FROM python:3.12-slim
|
|
WORKDIR /app
|
|
|
|
# Install deps
|
|
COPY backend/requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy backend source
|
|
COPY backend/ .
|
|
|
|
# Copy built frontend into backend/static
|
|
COPY --from=frontend-build /frontend/dist ./static
|
|
|
|
# Data directory for SQLite
|
|
RUN mkdir -p /app/data
|
|
|
|
ENV PYTHONPATH=/app
|
|
ENV DATABASE_URL=sqlite:////app/data/app.db
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|