Skip to content

Commit

Permalink
chore: fix local cache usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed May 8, 2024
1 parent e2b24d9 commit 1c81bce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,20 @@ if [ "${CI:-}" == "true" ]; then
fi
fi

USE_LOCAL_CACHE=0
if [ "${MANYLINUX_BUILD_FRONTEND}" == "docker" ]; then
docker build ${BUILD_ARGS_COMMON}
elif [ "${MANYLINUX_BUILD_FRONTEND}" == "podman" ]; then
podman build ${BUILD_ARGS_COMMON}
elif [ "${MANYLINUX_BUILD_FRONTEND}" == "docker-buildx" ]; then
USE_LOCAL_CACHE=1
docker buildx build \
--load \
--cache-from=type=local,src=$(pwd)/.buildx-cache-${POLICY}_${PLATFORM} \
--cache-to=type=local,dest=$(pwd)/.buildx-cache-staging-${POLICY}_${PLATFORM} \
${BUILD_ARGS_COMMON}
elif [ "${MANYLINUX_BUILD_FRONTEND}" == "buildkit" ]; then
USE_LOCAL_CACHE=1
buildctl build \
--frontend=dockerfile.v0 \
--local context=./docker/ \
Expand All @@ -108,7 +111,7 @@ fi

docker run --rm -v $(pwd)/tests:/tests:ro quay.io/pypa/${POLICY}_${PLATFORM}:${COMMIT_SHA} /tests/run_tests.sh

if ! [[ "${MANYLINUX_BUILD_FRONTEND}" =~ (docker)|(podman) ]]; then
if [ ${USE_LOCAL_CACHE} -ne 0 ]; then
if [ -d $(pwd)/.buildx-cache-${POLICY}_${PLATFORM} ]; then
rm -rf $(pwd)/.buildx-cache-${POLICY}_${PLATFORM}
fi
Expand Down

0 comments on commit 1c81bce

Please sign in to comment.