This repository has been archived by the owner on Apr 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.api
62 lines (49 loc) · 1.8 KB
/
Dockerfile.api
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
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM debian:buster-slim AS prepare
WORKDIR /src
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN \
apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
ca-certificates \
git
RUN git clone --depth=1 https://github.com/slsfi/digital_edition_api.git . \
&& rm sls_api/configs/*_example.yml
FROM python:3.6-slim-stretch
WORKDIR /app
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# build-essential is needed to build some libraries (mainly uwsgi and the various database support ones)
# libmariadbclient-dev is needed to build mysqlclient for mysql/mariadb support
RUN \
apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
libpcre3 \
libpcre3-dev \
ca-certificates \
gettext \
build-essential \
libmariadbclient-dev \
libpq-dev \
git \
&& useradd -u 10000 -ms /bin/bash uwsgi \
&& chown -R uwsgi /app
RUN pip install uwsgi
COPY --from=prepare --chown=uwsgi src/setup.py /app/setup.py
COPY --from=prepare --chown=uwsgi src/openapi.json /app/openapi.json
COPY --from=prepare --chown=uwsgi src/sls_api /app/sls_api
RUN pip install -e .
USER uwsgi
RUN \
mkdir -p ~/.config/git \
&& mkdir -p ~/.ssh \
&& git config --global credential.helper "store --file ~/.config/git/credentials" \
&& git config --global user.name "arkivverketbot" \
&& git config --global user.email "[email protected]" \
&& git config --global core.quotepath off
COPY --chown=uwsgi api/credentials.template /
COPY --chown=uwsgi api/10-envsubst-on-templates.sh /docker-entrypoint.d/
COPY --chown=uwsgi api/11-envsubst-git-credentials.sh /docker-entrypoint.d/
COPY --chown=uwsgi api/docker-entrypoint.sh /
COPY --chown=uwsgi api/uwsgi.ini /app/uwsgi.ini
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 3031
CMD ["uwsgi", "--ini", "/app/uwsgi.ini"]