-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile.collectors
90 lines (69 loc) · 2.04 KB
/
Dockerfile.collectors
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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.12-alpine3.21 AS production
WORKDIR /app/
# upgrade pip
RUN python -m pip install --upgrade pip
# install common packages
RUN \
apk add --no-cache \
firefox \
unzip \
libexif \
udev \
harfbuzz \
chromium \
chromium-chromedriver \
tor \
xvfb \
dbus-x11 \
font-noto-emoji \
freetype \
ttf-freefont && \
apk add --no-cache --virtual .build-deps \
wget \
tar && \
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz -O /tmp/geckodriver.tar.gz && \
cd /usr/local/bin/ && \
tar -xzf /tmp/geckodriver.tar.gz && \
rm -f /tmp/geckodriver.tar.gz && \
apk --purge del .build-deps
# 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/collectors/requirements.txt /app/requirements.txt
RUN \
apk add --no-cache --virtual .build-deps \
gcc \
g++ \
make \
musl-dev \
python3-dev \
libxslt-dev \
libxml2-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/collectors/. /app/
EXPOSE 80
# setup environment variables
ENV PYTHONPATH=/app
ENV MODULE_NAME run
ENV VARIABLE_NAME app
ENV GUNICORN_CMD_ARGS --timeout 120
ENV COLLECTOR_CONFIG_FILE /app/storage/id.txt
VOLUME ["/app/storage"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/start.sh"]