36 lines
852 B
Docker
36 lines
852 B
Docker
# Stage 1: Build the Angular frontend
|
|
FROM node:20-alpine AS frontend-builder
|
|
WORKDIR /app/frontend
|
|
|
|
# Install dependencies
|
|
COPY frontend/package.json ./
|
|
RUN npm install
|
|
|
|
# Build static assets
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Run the FastAPI backend
|
|
FROM python:3.12-slim AS backend-runner
|
|
WORKDIR /app
|
|
|
|
# Install backend dependencies
|
|
COPY backend/requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy backend application
|
|
COPY backend/ ./
|
|
|
|
# Copy built frontend static files from stage 1
|
|
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
|
|
|
|
# Expose API/Frontend port
|
|
EXPOSE 8000
|
|
|
|
# Set environment variables for production
|
|
ENV MONGODB_URI=mongodb://mongodb:27017
|
|
ENV DATABASE_NAME=coffee_control_center
|
|
|
|
# Run uvicorn server
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|