forked from SK-CERT/Taranis-NG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.publishers
68 lines (48 loc) · 1.46 KB
/
Dockerfile.publishers
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
66
67
68
FROM python:3.12-alpine3.19 AS build_shared
WORKDIR /build_shared/
RUN pip install --no-cache-dir build
COPY ./src/shared/. .
RUN python -m build
FROM python:3.12-alpine3.19 AS production
WORKDIR /app/
# upgrade pip
RUN python -m pip install --upgrade pip
# install "shared" package from build_shared stage
# TODO: somehow squash the following two layers into one to conserve space
COPY --from=build_shared /build_shared/dist/taranis_ng_shared-*.whl custom_packages/
RUN pip install --no-cache-dir ./custom_packages/taranis_ng_shared-*.whl && rm -rf ./custom_packages/
# install dependencies
COPY ./src/publishers/requirements.txt /app/requirements.txt
RUN apk add --no-cache \
swig \
libmagic \
gnupg
RUN \
apk add --no-cache --virtual .build-deps build-base \
gcc \
g++ \
make \
musl-dev \
python3-dev \
libffi-dev \
openssl-dev \
rust && \
pip install --no-cache-dir -r /app/requirements.txt && \
apk --purge del .build-deps
COPY ./docker/start.sh /start.sh
RUN chmod +x /start.sh
COPY ./docker/prestart.sh /app/prestart.sh
RUN chmod +x /app/prestart.sh
COPY ./docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY ./docker/gunicorn_conf.py /gunicorn_conf.py
EXPOSE 80
COPY ./src/publishers/. /app/
# setup environment variables
ENV PYTHONPATH=/app
ENV MODULE_NAME run
ENV VARIABLE_NAME app
ENV GUNICORN_CMD_ARGS --timeout 120
ENV WORKERS_PER_CORE 8
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/start.sh"]