/
Dockerfile
63 lines (51 loc) · 1.87 KB
/
Dockerfile
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
# This file is part of mettmail (https://github.com/spezifisch/mettmail).
# Copyright (c) 2022 spezifisch (https://github.com/spezifisch)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
FROM python:3.9.16-slim AS base
LABEL org.opencontainers.image.authors="spezifisch"
LABEL org.opencontainers.image.url="https://github.com/spezifisch/mettmail"
LABEL org.opencontainers.image.source="https://github.com/spezifisch/mettmail"
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random
FROM base AS builder
ARG PIP_DISABLE_PIP_VERSION_CHECK=on \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VERSION=1.1.12
# build deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
python3-dev \
unzip \
wget && \
pip install --no-cache-dir "poetry==$POETRY_VERSION"
WORKDIR /app
# install dependencies
COPY pyproject.toml poetry.lock /app/
RUN poetry install --no-dev --no-root
# build and install package
COPY . .
RUN poetry build && \
/app/.venv/bin/pip install --no-cache-dir dist/*.whl
# runtime image
FROM base AS runtime
COPY --from=builder /app/.venv/ /app/.venv
WORKDIR /app
RUN useradd mettmail
USER mettmail
ENTRYPOINT ["/app/.venv/bin/mettmail"]
CMD [ "--help" ]