diff --git a/Dockerfile b/Dockerfile index 4d7f302..a738e78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,14 @@ -FROM docker:24.0.8-dind - -RUN apk add --no-cache python3 python3-dev py3-pip gcc jq \ - git curl build-base autoconf automake py3-cryptography rsync \ - linux-headers musl-dev libffi-dev openssl-dev openssh-client +FROM python:3.12-alpine AS builder -RUN python3 -m venv --upgrade-deps /opt/venv +RUN apk add --no-cache python3 python3-dev py3-pip gcc \ + git curl build-base autoconf automake py3-cryptography \ + linux-headers musl-dev libffi-dev openssl-dev COPY . /usr/local/src/ansible_collection_helper -RUN /opt/venv/bin/pip install --no-cache-dir /usr/local/src/ansible_collection_helper &&\ - rm -rf /usr/local/src/ansible_collection_helper +RUN pip wheel --no-cache-dir --no-deps --wheel-dir /build/wheels /usr/local/src/ansible_collection_helper + +FROM docker:24.0.8-dind +RUN apk add --no-cache python3 py3-pip jq py3-cryptography rsync openssh-client +COPY --from=builder /build/wheels /wheels +RUN python3 -m venv /opt/venv/ +RUN /opt/venv/bin/pip install --no-cache-dir /wheels/*