forked from hetida/hetida-designer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-demo-adapter-python
49 lines (41 loc) · 1.68 KB
/
Dockerfile-demo-adapter-python
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
##### Build stage
FROM python:3.9.9-buster as base
ENV TIMEOUT=60
# Copy relevant files
COPY ./demo-adapter-python/pipt_locks.env /app/pipt_locks.env
COPY ./demo-adapter-python/pipt_config.env /app/pipt_config.env
COPY ./demo-adapter-python/requirements-base.txt /app/requirements-base.txt
COPY ./demo-adapter-python/requirements.txt /app/requirements.txt
COPY ./demo-adapter-python/requirements-dev.txt /app/requirements-dev.txt
COPY ./demo-adapter-python/pipt /app/pipt
WORKDIR /app
ENV PIPT_PIP_INSTALL_ARGS "--no-cache-dir"
ENV PIPT_PIP_SYNC_PIP_ARGS "--no-cache-dir --no-deps"
RUN ./pipt sync-system --prod
##### Intermediate stage with actual application content
FROM base AS application_base
COPY ./demo-adapter-python /app
COPY ./VERSION /app/VERSION
RUN chmod +x /app/start.sh
##### Production stage
# making prod stage available early allows to build it without building test stage
# since test stage is only necessary on build system
FROM application_base AS prod
RUN useradd -m hdda_app
USER hdda_app
# trying to make global multiprocessing.Manager objects possible across worker processes:
ENV GUNICORN_CMD_ARGS "--preload"
ENV PORT 8092
EXPOSE 8092
CMD ["/app/start.sh"]
##### Test stage
FROM application_base AS test
WORKDIR /app
RUN ./pipt sync-system --dev
RUN python3 -m pytest --cov=demo_adapter_python --cov-report xml --junitxml test_results.xml tests
RUN bash /app/scripts/gen_pylint_report.sh
# prod should still be the default build, this is why we close with FROM prod
# Note that in order to really skip the test stage you either need to explicitly specify the prod
# stage via
# docker build --target prod -f Dockerfile-demo-adapter-python . -t hetdes_demo_adapter_python
FROM prod