SateeshAmbesange's picture
Update Dockerfile
2d7b730 verified
raw
history blame contribute delete
965 Bytes
# --- Stage 1: Build React frontend ---
FROM node:18-alpine AS builder
WORKDIR /app/space
# Copy package files to /app/space
COPY frontend/package.json ./package.json
COPY frontend/package-lock.json ./package-lock.json
# Install frontend dependencies
RUN npm install
# Copy frontend source code and public folder explicitly
COPY frontend/src ./src
COPY frontend/public ./public
# Build the React app
RUN npm run build
# --- Stage 2: Build FastAPI backend and serve React build ---
FROM python:3.11-slim
WORKDIR /app/backend
# Copy Python dependencies and install
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r /app/requirements.txt
# Copy backend source code
COPY backend/. ./
# Copy React build output from builder stage into backend static folder
COPY --from=builder /app/space/build /app/backend/static
# Expose FastAPI port
EXPOSE 8080
# Run FastAPI app with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]