| 1 |
FROM python:3.14-slim |
| 2 |
|
| 3 |
LABEL org.opencontainers.image.source=https://github.com/benoitc/gunicorn |
| 4 |
LABEL org.opencontainers.image.description="Gunicorn Python WSGI HTTP Server" |
| 5 |
LABEL org.opencontainers.image.licenses=MIT |
| 6 |
|
| 7 |
# Create non-root user |
| 8 |
RUN useradd --create-home --shell /bin/bash gunicorn |
| 9 |
|
| 10 |
WORKDIR /app |
| 11 |
|
| 12 |
# Install gunicorn from source |
| 13 |
COPY pyproject.toml README.md LICENSE ./ |
| 14 |
COPY gunicorn/ ./gunicorn/ |
| 15 |
RUN pip install --no-cache-dir . |
| 16 |
|
| 17 |
# Copy entrypoint script |
| 18 |
COPY docker/docker-entrypoint.sh /usr/local/bin/ |
| 19 |
RUN chmod +x /usr/local/bin/docker-entrypoint.sh |
| 20 |
|
| 21 |
# Configuration via environment: |
| 22 |
# GUNICORN_BIND - full bind address (default: 0.0.0.0:8000) |
| 23 |
# GUNICORN_HOST - bind host (default: 0.0.0.0) |
| 24 |
# GUNICORN_PORT - bind port (default: 8000) |
| 25 |
# GUNICORN_WORKERS - number of workers (default: 2 * CPU + 1) |
| 26 |
# GUNICORN_ARGS - additional arguments (e.g., "--timeout 120") |
| 27 |
|
| 28 |
USER gunicorn |
| 29 |
|
| 30 |
EXPOSE 8000 |
| 31 |
|
| 32 |
ENTRYPOINT ["docker-entrypoint.sh"] |
| 33 |
CMD ["--help"] |