-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 899 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (23 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set working directory
WORKDIR /app
# Install git
RUN apt-get update && apt-get install -y git
# Install dependencies
COPY requirements.txt /app/
RUN python -m venv venv && \
. venv/bin/activate && \
pip install --no-cache-dir -r requirements.txt
EXPOSE 6060
# Bind to both IPv4 and IPv6
ENV GUNICORN_CMD_ARGS="--bind=[::]:6060"
# Put venv on PATH so installed CLI tools (e.g. git-fame) are accessible
ENV PATH="/app/venv/bin:$PATH"
# Copy project
COPY . /app/
# Run the application: gthread worker class allows concurrent I/O-bound requests
# without head-of-line blocking from a single sync worker.
CMD ["venv/bin/gunicorn", "api.wsgi:app", "--log-file=-", "--log-level", "info", "--preload", "--worker-class", "gthread", "--workers", "2", "--threads", "8", "--timeout", "120"]