Create webhook service to alert on Matrix

This commit is contained in:
Remi Rampin 2022-11-04 19:28:42 -04:00
commit 041eef2a7d
7 changed files with 600 additions and 0 deletions

35
Dockerfile Normal file
View file

@ -0,0 +1,35 @@
FROM python:3.10 AS deps
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 - && /root/.local/bin/poetry config virtualenvs.create false
# Copy Poetry data
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY pyproject.toml poetry.lock ./
# Generate requirements list
RUN /root/.local/bin/poetry export -o requirements.txt
FROM python:3.10
# Install requirements
COPY --from=deps /usr/src/app/requirements.txt /requirements.txt
RUN pip --disable-pip-version-check install --no-cache-dir -r /requirements.txt
# Set up app
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY grafana_webhook_to_matrix.py ./
# Set up user
RUN mkdir -p /usr/src/app/home && \
useradd -d /usr/src/app/home -s /usr/sbin/nologin -u 998 appuser && \
chown appuser /usr/src/app/home
ENV PYTHONFAULTHANDLER=1
USER 998
EXPOSE 8003
CMD ["python3", "grafana_webhook_to_matrix.py"]