forked from opencobra/memote-webservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (32 loc) · 1.18 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
36
37
38
39
40
41
42
43
FROM python:3.8-slim
ENV PYTHONUNBUFFERED=1
# The sympy cache causes significant memory leaks as it is currently used by
# optlang. Disable it by default.
ENV SYMPY_USE_CACHE=no
ENV APP_USER=kaa
ENV HOME="/home/${APP_USER}"
ARG UID=1000
ARG GID=1000
ARG CWD="${HOME}/app"
ENV PYTHONPATH="${CWD}/src"
RUN groupadd --system --gid "${GID}" "${APP_USER}" \
&& useradd --system --create-home --home-dir "${HOME}" \
--uid "${UID}" --gid "${APP_USER}" "${APP_USER}"
WORKDIR "${CWD}"
COPY requirements.txt "${CWD}/"
# `g++` is required for building `gevent` but all build dependencies are
# later removed again.
RUN set -eux \
&& apt-get update \
&& apt-get install --yes --only-upgrade openssl ca-certificates \
&& apt-get install --yes --no-install-recommends \
build-essential libssl-dev \
&& pip install --upgrade pip setuptools wheel \
&& pip install --no-deps --require-hashes --requirement requirements.txt \
&& rm -rf /root/.cache/pip \
&& apt-get purge --yes build-essential \
&& apt-get autoremove --yes \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY . "${CWD}/"
RUN chown -R "${APP_USER}:${APP_USER}" "${CWD}"