-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
35 lines (26 loc) · 1.07 KB
/
Dockerfile
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
32
33
34
35
FROM python:3.10-slim
# Update packages
RUN apt-get update && apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
# Set up working folder:
WORKDIR /usr/src/access
# Install dependencies:
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy in app files:
COPY . .
# Somewhere to store multi-process metrics for Prometheus:
RUN mkdir /tmp_multiproc
# Pick up API version from a build arg.
# See hooks/build.
ARG API_VERSION=dev
ENV API_VERSION=$API_VERSION
# Override this to mount the service at a prefix, e.g. /api/v1/
ENV SCRIPT_NAME="/api"
# Override the worker count:
ENV WORKERS=2
ENV PROMETHEUS_MULTIPROC_DIR=/tmp_multiproc
ENV LOG_LEVEL=info
# Run command with sh so env vars are substituted:
#CMD ["sh", "-c", "uvicorn ukwa_api.main:app --host 0.0.0.0 --port 8000 --root-path ${ROOT_PATH} --workers ${WORKERS} --forwarded-allow-ips='*' --proxy-headers"]
CMD ["sh", "-c", "gunicorn -k ukwa_api.worker.UkwaApiWorker ukwa_api.main:app --bind 0.0.0.0:8000 --workers ${WORKERS} --forwarded-allow-ips '*' --log-level ${LOG_LEVEL} --access-logfile -"]