-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (43 loc) · 1.21 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM python:3.11-bookworm as base
ENV TZ=Europe/Amsterdam
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=off
WORKDIR /api
RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get autoremove -y \
&& apt-get install -y --no-install-recommends \
nano \
openssh-server \
&& pip install --upgrade pip \
&& pip install uwsgi
COPY requirements.txt /api
RUN pip install -r requirements.txt
COPY ./scripts /api/scripts
COPY ./app /api/app
FROM base as tests
COPY conf/test.sh /api/
COPY .flake8 /api/
RUN chmod u+x /api/test.sh
ENTRYPOINT [ "/bin/sh", "/api/test.sh"]
FROM base as publish
# ssh ( see also: https://github.com/Azure-Samples/docker-django-webapp-linux )
ARG SSH_PASSWD
ENV SSH_PASSWD=$SSH_PASSWD
EXPOSE 8000
ENV PORT 8000
ARG MA_OTAP_ENV
ENV MA_OTAP_ENV=$MA_OTAP_ENV
ARG MA_BUILD_ID
ENV MA_BUILD_ID=$MA_BUILD_ID
ARG MA_GIT_SHA
ENV MA_GIT_SHA=$MA_GIT_SHA
ARG MA_CONTAINER_SSH_ENABLED=false
ENV MA_CONTAINER_SSH_ENABLED=$MA_CONTAINER_SSH_ENABLED
COPY conf/uwsgi.ini /api/
COPY conf/docker-entrypoint.sh /api/
COPY conf/sshd_config /etc/ssh/
RUN chmod u+x /api/docker-entrypoint.sh \
&& echo "$SSH_PASSWD" | chpasswd
ENTRYPOINT [ "/bin/sh", "/api/docker-entrypoint.sh"]
FROM publish as publish-final