-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathDockerfile-demo-adapter-python
More file actions
46 lines (37 loc) · 1.54 KB
/
Dockerfile-demo-adapter-python
File metadata and controls
46 lines (37 loc) · 1.54 KB
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
##### Base stage
FROM --platform=linux/amd64 python:3.13.7-slim-trixie 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
##### Test stage
# Note that in order to really build the test stage you need to explicitly specify it via
# docker build --target test -f Dockerfile-demo-adapter-python . -t hetdes_demo_adapter_python
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_ruff_report.sh
##### Production stage
# prod should be the default build, this is why we close with FROM prod
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"]