From a1878f840f621744b8ebb46187e3ca6f61ca000d Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Tue, 13 Oct 2020 15:44:31 +0100 Subject: [PATCH] Run as non-root user --- Dockerfile | 4 ++-- README.md | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4298d88..9ad93a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,8 @@ WORKDIR /app ADD alertify.py /app # Switching to a non-root user, please refer to https://aka.ms/vscode-docker-python-user-rights -# RUN useradd appuser && chown -R appuser /app -# USER appuser +RUN useradd appuser && chown -R appuser /app +USER appuser EXPOSE 8080 diff --git a/README.md b/README.md index 00ca234..4c9db3f 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,16 @@ This application bridges Alertmanager alerts to [Gotify](https://gotify.net). # Docker +## Build +```bash +docker build . -t 'alertify:latest' +``` + ## Run e.g. ```bash -docker run -p 8080:8080 -e TZ=Europe/London -e GOTIFY_KEY=XXXXXXXX -e GOTIFY_SERVER=gotify -e GOTIFY_PORT=80 alertify:latest +docker run --name alertify -p 8080:8080 -e TZ=Europe/London -e GOTIFY_KEY=XXXXXXXX -e GOTIFY_SERVER=gotify -e GOTIFY_PORT=80 alertify:latest ``` ## Compose: