29 lines
636 B
Docker
29 lines
636 B
Docker
# Use official Python image
|
|
FROM python:3.11-slim
|
|
|
|
# Set work directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
libpq-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements and install
|
|
COPY requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy backend code
|
|
COPY . .
|
|
|
|
# Expose Flask port
|
|
EXPOSE 5000
|
|
|
|
# Set environment variables
|
|
ENV FLASK_APP=main.py
|
|
ENV FLASK_ENV=production
|
|
|
|
# Start the Flask app (use gunicorn for production)
|
|
CMD ["gunicorn", "main:app", "--bind", "0.0.0.0:5000", "--worker-class", "eventlet", "--workers", "1"]
|