From e8fe316ecb2392abde91b57a8843b1e6e6a47dfd Mon Sep 17 00:00:00 2001 From: Dariusz Gertych Date: Tue, 7 Dec 2021 10:25:11 +0100 Subject: [PATCH] Dockerfile improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - use alpine because it’s slimmer than buster - use entrypoint https://phoenixnap.com/kb/docker-cmd-vs-entrypoint - extend path to easily invoke sendria binary - allow to build any version using build-arg - fix maintainer deprecation https://docs.docker.com/engine/reference/builder/#maintainer-deprecated --- Dockerfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index dc846c4..11bda23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,14 @@ -FROM python:3.8-slim-buster -MAINTAINER Marcin Sztolcman +FROM python:3.10-alpine as build +LABEL org.opencontainers.image.authors="Marcin Sztolcman " -RUN useradd --create-home sendria +ARG VERSION=2.2.2 + +RUN addgroup -S sendria && adduser -S sendria -G sendria WORKDIR /home/sendria USER sendria -RUN python3 -m pip install --user sendria==2.2.2 +RUN python3 -m pip install --user sendria==$VERSION +ENV PATH="/home/sendria/.local/bin:$PATH" EXPOSE 1025 1080 -CMD ["/home/sendria/.local/bin/sendria", "--foreground", "--db=./mails.sqlite", "--smtp-ip=0.0.0.0", "--http-ip=0.0.0.0"] - +ENTRYPOINT [ "sendria", "--foreground", "--db=./mails.sqlite", "--smtp-ip=0.0.0.0", "--http-ip=0.0.0.0" ]