summaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 05:06:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 05:06:46 +0000
commit92240acb5cc600eec60624ece9ed4b9ec43b386f (patch)
tree13328d0de4f37030731a96e25749563742fce0cb /Dockerfile
parentAdding upstream version 0.14.0. (diff)
downloadanta-92240acb5cc600eec60624ece9ed4b9ec43b386f.tar.xz
anta-92240acb5cc600eec60624ece9ed4b9ec43b386f.zip
Adding upstream version 0.15.0.upstream/0.15.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile28
1 files changed, 20 insertions, 8 deletions
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" ]