37 lines
827 B
Docker
37 lines
827 B
Docker
# Stage 1: Build frontend static assets
|
|
FROM node:20-alpine AS frontend-build
|
|
WORKDIR /app/frontend
|
|
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
|
|
# Stage 2: Runtime image for backend + static frontend
|
|
FROM python:3.11-slim AS runtime
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV BACKEND_PORT=8000
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY backend/requirements.txt /app/backend/requirements.txt
|
|
RUN pip install --no-cache-dir -r /app/backend/requirements.txt
|
|
|
|
COPY backend/ /app/backend/
|
|
COPY --from=frontend-build /app/frontend/build /app/frontend/build
|
|
|
|
WORKDIR /app/backend
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["python", "-m", "uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "8000"]
|