| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- # Multi-stage build: Frontend + Backend + Worker in one image
- # ============================================================
- # Stage 1: Build frontend
- FROM node:20-alpine AS frontend-builder
- WORKDIR /app/frontend
- COPY frontend/package.json frontend/yarn.lock ./
- RUN yarn install --frozen-lockfile
- COPY frontend/ ./
- RUN yarn build
- # Stage 2: Python runtime
- FROM python:3.11-slim AS runtime
- # Install system dependencies
- RUN apt-get update && apt-get install -y --no-install-recommends \
- gcc \
- libpq-dev \
- && rm -rf /var/lib/apt/lists/*
- WORKDIR /app
- # Install Python dependencies
- COPY backend/requirements.txt ./
- RUN pip install --no-cache-dir -r requirements.txt gunicorn
- # Copy backend code
- COPY backend/ ./
- # Copy frontend build to static folder
- COPY --from=frontend-builder /app/frontend/dist ./static
- # Copy report template
- COPY sample-reports/ ./sample-reports/
- # Copy cloudshell scanner for download
- COPY cloudshell_scanner.py ./static/downloads/cloudshell_scanner.py
- # Create necessary directories
- RUN mkdir -p uploads reports uploads/scan_data instance
- # Environment variables
- ENV FLASK_ENV=production
- ENV PYTHONUNBUFFERED=1
- # Expose port
- EXPOSE 5000
- # Default command: run web server
- CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "run:app"]
|