From 57f704845136d9d0f0266c880cfa1dd7b902e880 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 23 May 2024 07:06:51 +0200 Subject: Merging upstream version 0.15.0. Signed-off-by: Daniel Baumann --- Dockerfile | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 2a0ef53..873bc1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,23 +3,30 @@ ARG IMG_OPTION=alpine ### BUILDER -FROM python:${PYTHON_VER}-${IMG_OPTION} as BUILDER +FROM python:${PYTHON_VER}-${IMG_OPTION} AS BUILDER RUN pip install --upgrade pip WORKDIR /local COPY . /local -ENV PYTHONPATH=/local -ENV PATH=$PATH:/root/.local/bin +RUN python -m venv /opt/venv -RUN pip --no-cache-dir install --user . + +ENV PATH="/opt/venv/bin:$PATH" + +RUN apk add --no-cache build-base # Add build-base package +RUN pip --no-cache-dir install "." &&\ + pip --no-cache-dir install ".[cli]" # ----------------------------------- # ### BASE -FROM python:${PYTHON_VER}-${IMG_OPTION} as BASE +FROM python:${PYTHON_VER}-${IMG_OPTION} AS BASE + +# Add a system user +RUN adduser --system anta # Opencontainer labels # Labels version and revision will be updating @@ -40,7 +47,12 @@ LABEL "org.opencontainers.image.title"="anta" \ "org.opencontainers.image.revision"="dev" \ "org.opencontainers.image.version"="dev" -COPY --from=BUILDER /root/.local/ /root/.local -ENV PATH=$PATH:/root/.local/bin +# Copy artifacts from builder +COPY --from=BUILDER /opt/venv /opt/venv + +# Define PATH and default user +ENV PATH="/opt/venv/bin:$PATH" + +USER anta -ENTRYPOINT [ "/root/.local/bin/anta" ] +ENTRYPOINT [ "/opt/venv/bin/anta" ] -- cgit v1.2.3