-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile.bots
59 lines (41 loc) · 1.32 KB
/
Dockerfile.bots
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
FROM python:3.13-alpine3.21 AS build_shared
WORKDIR /build_shared/
RUN pip install --no-cache-dir build
COPY ./src/shared/. .
RUN python -m build
FROM python:3.13-alpine3.21 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/bots/requirements.txt /app/requirements.txt
RUN \
apk add --no-cache --virtual .build-deps \
gcc \
g++ \
make \
musl-dev \
python3-dev \
libffi-dev && \
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
COPY ./src/bots/. /app/
EXPOSE 80
# setup environment variables
ENV PYTHONPATH=/app
ENV MODULE_NAME run
ENV VARIABLE_NAME app
ENV GUNICORN_CMD_ARGS --timeout 120
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/start.sh"]