Spaces:
Sleeping
Sleeping
File size: 1,019 Bytes
eadb9a4 85b09a4 eadb9a4 85b09a4 eadb9a4 85b09a4 eadb9a4 85b09a4 eadb9a4 85b09a4 eadb9a4 85b09a4 eadb9a4 ae4e258 eadb9a4 ae4e258 eadb9a4 571acfd a6d1789 ae4e258 eadb9a4 ae4e258 eadb9a4 ae4e258 eadb9a4 9383bfc eadb9a4 9383bfc eadb9a4 ae4e258 |
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 35 36 37 38 39 40 41 42 43 44 45 |
# Stage 1: Build frontend
FROM node:latest AS frontend
# Set working directory for frontend
WORKDIR /app/frontend
# Copy frontend source code
COPY frontend/package.json frontend/package-lock.json ./
COPY frontend .
# Install dependencies
RUN npm install
# Build frontend
RUN npm run build
# Stage 2: Build backend
FROM python:3.9-slim AS backend
# Set working directory for backend
WORKDIR /app/backend
# Copy backend source code
COPY backend .
# Install backend dependencies
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt --vvv
# Stage 3: Serve frontend and backend using nginx and gunicorn
FROM nginx:latest AS production
# Copy built frontend files from the frontend stage to nginx
COPY --from=frontend /app/frontend/dist /usr/share/nginx/html
# Copy built backend code from the backend stage
COPY --from=backend /app/backend /app/backend
# Expose port 80 for nginx
EXPOSE 80
# Start gunicorn server for backend
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "app:app"]
|