diff options
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -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" ] |