docappointemet / Dockerfile
Admin Idiakhoa
Add initial app code
db56fd6
raw
history blame
879 Bytes
# 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"]