FROM scratch AS base ENV VERSION=2.15.31 ENV SRC_HASH=6507f894a30036ad002b54e12f49959c592c8507765405c52cf7b4ba4dc2509d ENV SRC_FILE=${VERSION}.tar.gz ENV SRC_SITE=https://github.com/aws/aws-cli/archive/refs/tags/${VERSION}/${SRC_FILE} FROM base AS fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . FROM fetch AS build COPY --from=stagex/busybox . / COPY --from=stagex/musl . / COPY --from=stagex/zlib . / COPY --from=stagex/sqlite3 . / COPY --from=stagex/python . / COPY --from=stagex/gcc . / COPY --from=stagex/libunwind . / COPY --from=stagex/libffi . / COPY --from=stagex/openssl . / COPY --from=stagex/py-flit . / COPY --from=stagex/py-gpep517 . / COPY --from=stagex/py-installer . / COPY --from=stagex/py-distro . / COPY --from=stagex/py-jmespath . / COPY --from=stagex/py-dateutil . / COPY --from=stagex/py-urllib3 . / COPY --from=stagex/py-cffi . / COPY --from=stagex/py-six . / COPY --from=stagex/py-botocore . / COPY --from=stagex/py-awscrt . / COPY --from=stagex/py-certifi . / COPY --from=stagex/py-cryptography . / COPY --from=stagex/py-colorama . / COPY --from=stagex/py-docutils . / COPY --from=stagex/py-wcwidth . / COPY --from=stagex/py-prompt_toolkit . / COPY --from=stagex/py-ruamel.yaml . / RUN tar -xzf ${SRC_FILE} WORKDIR aws-cli-${VERSION} RUN --network=none \ gpep517 build-wheel \ --wheel-dir .dist \ --output-fd 3 3>&1 >&2 FROM build AS install RUN --network=none <<-EOF set -eu python -m installer -d /rootfs .dist/*.whl find /rootfs | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf rm /rootfs/usr/lib/python*/site-packages/awscli-*.dist-info/RECORD EOF FROM stagex/filesystem AS package COPY --from=install /rootfs/. /