-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
47 lines (31 loc) · 1.5 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
44
45
46
47
ARG PYTHON_VERSION=3.7
ARG BASE_IMAGE=buster
FROM python:${PYTHON_VERSION}-${BASE_IMAGE} as builder
WORKDIR /build
RUN pip install pipenv && pip install --user --ignore-installed --no-warn-script-location uwsgi
COPY Pipfile* ./
# Pipenv will ignore qualifying system packages during install, so we need to route through pip to ensure everything
# really ends up in our /root/.local folder where we want it to be
RUN pipenv lock --keep-outdated -r >requirements.txt && rm -rf /root/.local/share/virtualenv*
RUN pip install --user --ignore-installed --no-warn-script-location -r requirements.txt
FROM python:${PYTHON_VERSION}-slim-${BASE_IMAGE} as app
LABEL Maintainer="Directive Games <[email protected]>"
RUN addgroup --gid 1000 uwsgi && useradd -ms /bin/bash uwsgi -g uwsgi
RUN UWSGI_RUNTIME_DEPS=libxml2 \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${UWSGI_RUNTIME_DEPS}
WORKDIR /app
COPY --chown=uwsgi:uwsgi --from=builder /root/.local/ /home/uwsgi/.local/
COPY . .
ARG VERSION
ARG BUILD_TIMESTAMP
ARG COMMIT_HASH
LABEL AppVersion="${VERSION}"
LABEL CommitHash="${COMMIT_HASH}"
# For runtime consumption
RUN echo '{"version": "'${VERSION}'", "build_timestamp": "'${BUILD_TIMESTAMP}'", "commit_hash": "'${COMMIT_HASH}'"}' > .build_info
USER uwsgi
ENV PATH /home/uwsgi/.local/bin:$PATH
# run dconf to initialize the local drift config store
# CMD dconf developer -r
CMD ["/home/uwsgi/.local/bin/uwsgi", "--ini", "/app/config/uwsgi.ini"]