Spaces:
Runtime error
Runtime error
File size: 879 Bytes
db56fd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Stage 1: Build the frontend
FROM node:18-alpine AS builder
# Set the working directory
WORKDIR /app/frontend
# Copy package files and install dependencies
COPY frontend/package.json frontend/package-lock.json ./
RUN npm install
# Copy the rest of the frontend code and build it
COPY frontend/ ./
RUN npm run build
# ---
# Stage 2: Build the final Python image
FROM python:3.9-slim
WORKDIR /app
# Copy Python dependency file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the built frontend assets from the 'builder' stage
COPY --from=builder /app/frontend/build ./static
# Copy your backend application code
COPY . .
# Expose the port your app will run on and define the startup command
EXPOSE 8000
CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "app.main:app", "--bind", "0.0.0.0:8000"] |