1- FROM python:3.12-slim-bookworm
1+ FROM python:3.12-slim-trixie AS builder
22WORKDIR /
33
4-
5- ENV PYTHONUNBUFFERED=1
6- ENV PIP_DISABLE_PIP_VERSION_CHECK=1
7- ENV PIP_NO_CACHE_DIR=1
8-
94ARG BUILD_DATE
105ARG RELEASE
116ARG VERSION
127
13- ENV GAPIT_VERSION=${RELEASE}
148ENV SERVER_VERSION=${RELEASE}
159ENV CLIENT_VERSION=4.0.0
1610ENV WEBUI_VERSION=${RELEASE}
1711
18- ENV NGINX_WORKER_PROCESSES=1
19- ENV NGINX_WORKER_CONNECTIONS=1024
20-
21- ENV UWSGI_PROCESSES=5
22- ENV UWSGI_LISTEN=100
23- ENV UWSGI_BUFFER_SIZE=8192
24- ENV UWSGI_MAX_WORKER_LIFETIME=30
25- ENV UWSGI_WORKER_LIFETIME_DELTA=3
26- ENV FRONTEND_BASE_URL=/
27-
28- ENV HEARTBEAT_SEVERITY=major
12+ ENV PYTHONUNBUFFERED=1
13+ ENV PIP_DISABLE_PIP_VERSION_CHECK=1
14+ ENV PIP_NO_CACHE_DIR=1
2915
3016SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
3117
3218RUN apt-get update && \
3319 apt-get upgrade -y && \
3420 apt-get install -y --no-install-recommends \
3521 build-essential \
36- curl \
3722 git \
3823 gnupg2 \
3924 libldap2-dev \
4025 libpq-dev \
4126 libsasl2-dev \
42- postgresql-client \
4327 python3-dev \
44- supervisor \
45- libpcre3 \
46- libpcre3-dev \
28+ libpcre2-dev \
29+ libpcre2-8-0 \
4730 ca-certificates \
4831 xmlsec1 && \
4932 apt-get -y clean && \
5033 apt-get -y autoremove && \
5134 rm -rf /var/lib/apt/lists/*
5235
53- RUN curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - && \
54- echo "deb https://nginx.org/packages/debian/ buster nginx" | tee /etc/apt/sources.list.d/nginx.list && \
55- apt-get update && \
56- apt-get install -y --no-install-recommends \
57- nginx && \
58- apt-get -y clean && \
59- apt-get -y autoremove && \
60- rm -rf /var/lib/apt/lists/*
6136
6237COPY requirements*.txt /app/
6338
6439# hadolint ignore=DL3013
65- RUN pip install --no-cache-dir pip virtualenv jinja2 && \
40+ RUN pip install --no-cache-dir pip virtualenv && \
6641 python3.12 -m venv /venv && \
6742 /venv/bin/pip install --no-cache-dir --upgrade setuptools && \
6843 /venv/bin/pip install --no-cache-dir --requirement /app/requirements.txt && \
69- /venv/bin/pip install --no-cache-dir --requirement /app/requirements-docker.txt
44+ /venv/bin/pip install --no-cache-dir --requirement /app/requirements-docker.txt && \
45+ /venv/bin/pip install --no-cache-dir jinja2
46+
7047ENV PATH=$PATH:/venv/bin
48+
49+ # download and install alerta client
7150ADD https://github.com/gapitio/python-alerta-client/releases/download/v${CLIENT_VERSION}/alerta-client.tar.gz /tmp/client/client.tar.gz
7251RUN tar zxvf /tmp/client/client.tar.gz -C /tmp/client/ && \
7352 find /tmp/client/dist -name "*-py2.py3-none-any.whl" -print0 | xargs -0 -I{} /venv/bin/pip install {}
53+
54+ # download and install alerta server/backend
7455ADD https://github.com/gapitio/alerta/releases/download/${SERVER_VERSION}/alerta-api.tar.gz /tmp/backend/alerta.tar.gz
7556RUN tar zxvf /tmp/backend/alerta.tar.gz -C /tmp/backend && \
7657 find /tmp/backend/dist -name "*-py2.py3-none-any.whl" -print0 | xargs -0 -I{} /venv/bin/pip install {}
77- COPY install-plugins.sh /app/install-plugins.sh
78- COPY plugins.txt /app/plugins.txt
79- RUN /app/install-plugins.sh
8058
81- ENV ALERTA_SVR_CONF_FILE=/app/alertad.conf
82- ENV ALERTA_CONF_FILE=/app/alerta.conf
8359
60+ # download alerta frontend
8461ADD https://github.com/gapitio/alerta-webui/releases/download/${WEBUI_VERSION}/alerta-webui.tar.gz /tmp/webui.tar.gz
8562RUN tar zxvf /tmp/webui.tar.gz -C /tmp && \
8663 mv /tmp/dist /web
8764
65+
66+ FROM python:3.12-slim-trixie AS runtime
67+ WORKDIR /
68+
69+ COPY --from=builder /venv /venv
70+ COPY --from=builder /web /web
71+ COPY --from=builder /app /app
72+
73+ ARG RELEASE
74+ ENV GAPIT_VERSION=${RELEASE}
75+
76+ ENV PYTHONUNBUFFERED=1
77+ ENV PIP_DISABLE_PIP_VERSION_CHECK=1
78+ ENV PIP_NO_CACHE_DIR=1
79+ ENV PATH=$PATH:/venv/bin
80+
81+ ENV NGINX_WORKER_PROCESSES=1
82+ ENV NGINX_WORKER_CONNECTIONS=1024
83+
84+ ENV UWSGI_PROCESSES=5
85+ ENV UWSGI_LISTEN=100
86+ ENV UWSGI_BUFFER_SIZE=8192
87+ ENV UWSGI_MAX_WORKER_LIFETIME=30
88+ ENV UWSGI_WORKER_LIFETIME_DELTA=3
89+ ENV FRONTEND_BASE_URL=/
90+
91+ ENV HEARTBEAT_SEVERITY=major
92+
8893ENV ALERTA_SVR_CONF_FILE=/app/alertad.conf
8994ENV ALERTA_CONF_FILE=/app/alerta.conf
9095ENV ALERTA_WEB_CONF_FILE=/web/config.json
9196
97+ RUN apt-get update && \
98+ apt-get upgrade -y && \
99+ apt-get install -y --no-install-recommends \
100+ gnupg2 \
101+ libpq-dev \
102+ supervisor \
103+ ca-certificates \
104+ xmlsec1 \
105+ nginx && \
106+ apt-get -y clean && \
107+ apt-get -y autoremove && \
108+ rm -rf /var/lib/apt/lists/*
109+
92110COPY config/templates/app/ /app
93111COPY config/templates/web/ /web
94112
95113RUN ln -sf /dev/stdout /var/log/nginx/access.log \
96114 && ln -sf /dev/stderr /var/log/nginx/error.log
97115
116+ # user and permissions
98117RUN chgrp -R 0 /app /venv /web && \
99118 chmod -R g=u /app /venv /web && \
100119 useradd -u 1001 -g 0 -d /app alerta
101120
102121USER 1001
103122
104- COPY docker-entrypoint.sh /usr/local/bin/
105-
123+ # entry point
106124ENV INIT_LOG=false
107-
125+ COPY docker-entrypoint.sh /usr/local/bin/
108126ENTRYPOINT ["docker-entrypoint.sh" ]
109127
110128EXPOSE 8080 1717
111- CMD ["supervisord" , "-c" , "/app/supervisord.conf" ]
129+ CMD ["supervisord" , "-c" , "/app/supervisord.conf" ]
0 commit comments