34 lines
698 B
Docker
34 lines
698 B
Docker
# Stage 1: Build React Frontend UI
|
|
FROM node:20-alpine AS frontend-builder
|
|
WORKDIR /app/frontend
|
|
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Python Backend Runtime
|
|
FROM python:3.11-slim
|
|
WORKDIR /app
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PORT=8000
|
|
ENV HOST=0.0.0.0
|
|
|
|
# Install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy backend application code
|
|
COPY backend/ ./backend/
|
|
|
|
# Copy compiled static frontend into backend/app/static
|
|
COPY --from=frontend-builder /app/frontend/dist ./backend/app/static
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["python", "backend/main.py"]
|