36 أسطر
815 B
Docker
36 أسطر
815 B
Docker
# Build stage for React frontend
|
|
FROM node:18-alpine AS frontend-build
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package*.json ./
|
|
RUN npm install
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Production stage for Python backend
|
|
FROM python:3.11-slim
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies for database clients
|
|
RUN apt-get update && apt-get install -y \
|
|
default-mysql-client \
|
|
postgresql-client \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy built frontend
|
|
COPY --from=frontend-build /app/dist ./dist
|
|
|
|
# Copy backend
|
|
COPY backend/ ./backend/
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r backend/requirements.txt gunicorn
|
|
|
|
# Environment variables
|
|
ENV FLASK_APP=backend/app.py
|
|
ENV PORT=8000
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Run with gunicorn
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "backend.app:app"] |