35 lines
1006 B
Docker
35 lines
1006 B
Docker
# Dockerfile (prod)
|
|
FROM python:3.10-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
# System deps needed by geopandas/shapely/pyproj, mysqlclient, etc.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
curl \
|
|
libgeos-dev \
|
|
libspatialindex-dev \
|
|
libproj-dev proj-data proj-bin \
|
|
gdal-bin libgdal-dev \
|
|
python3-dev pkg-config \
|
|
default-libmysqlclient-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Install Python deps first (layer cache friendly)
|
|
COPY requirements.txt .
|
|
RUN python -m pip install --upgrade pip \
|
|
&& pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy project
|
|
COPY . .
|
|
|
|
# Expose prod port (compose overrides CMD/port, but this documents intent)
|
|
EXPOSE 8002
|
|
|
|
# Default CMD (compose will override with your shell that migrates, collectstatic, and runs gunicorn:8002)
|
|
CMD ["gunicorn", "polisplexity.wsgi:application", "--bind", "0.0.0.0:8002", "--workers=3", "--timeout=180"]
|