-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
49 lines (37 loc) · 1.17 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
48
49
# only build and install pip stuff here
FROM python:3.10-alpine AS build
LABEL maintainer=henri.wahl@mailbox.org
RUN apk update &&\
apk upgrade
# needed to build brotli
RUN apk add gcc \
g++ \
git \
libc-dev
# store git info from doko3000 repo
COPY . /doko3000
WORKDIR /doko3000
RUN git log --max-count 1 --decorate=short | head -n 1 > git_info
# build and install required pip packages
COPY ./requirements.txt requirements.txt
RUN pip install --requirement requirements.txt
# smaller image for running container
FROM python:3.10-alpine
LABEL maintainer=henri.wahl@mailbox.org
RUN apk update &&\
apk upgrade
# needed to run brotli
RUN apk add libgcc \
libstdc++
# due to being installed via pip the installation can be copied without dev files
# doko3000 directory has git_info file
COPY --from=build /usr/local/bin /usr/local/bin
COPY --from=build /usr/local/lib /usr/local/lib
COPY --from=build /doko3000 /doko3000
WORKDIR /doko3000
# run gunicorn workers as unprivileged user
RUN adduser -D doko3000
# entrypoint.sh runs gunicorn
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]