Files
sunnypilot/selfdrive/test/docker_build.sh
Justin Newberry 2a934cf3c8 CI: disable registry caching (#30474)
* Revert "CI: separate image for docker cache (#30413)"

This reverts commit ce7c4abe37343b78c3a0da66ec784fd71a46e53a.

* Revert "CI: enable buildx for registry cache (#30473)"

This reverts commit 528b1be03ac407184f19b8d4901cdc5a7c96e7eb.
old-commit-hash: 291c04163a
2023-11-15 18:21:57 -08:00

27 lines
850 B
Bash
Executable File

#!/usr/bin/env bash
set -e
# To build sim and docs, you can run the following to mount the scons cache to the same place as in CI:
# mkdir -p .ci_cache/scons_cache
# sudo mount --bind /tmp/scons_cache/ .ci_cache/scons_cache
SCRIPT_DIR=$(dirname "$0")
OPENPILOT_DIR=$SCRIPT_DIR/../../
if [ -n "$TARGET_ARCHITECTURE" ]; then
PLATFORM="linux/$TARGET_ARCHITECTURE"
TAG_SUFFIX="-$TARGET_ARCHITECTURE"
else
PLATFORM="linux/$(uname -m)"
TAG_SUFFIX=""
fi
source $SCRIPT_DIR/docker_common.sh $1 "$TAG_SUFFIX"
DOCKER_BUILDKIT=1 docker buildx build --platform $PLATFORM --load --cache-to type=inline --cache-from type=registry,ref=$REMOTE_TAG -t $REMOTE_TAG -t $LOCAL_TAG -f $OPENPILOT_DIR/$DOCKER_FILE $OPENPILOT_DIR
if [ -n "$PUSH_IMAGE" ]; then
docker push $REMOTE_TAG
docker tag $REMOTE_TAG $REMOTE_SHA_TAG
docker push $REMOTE_SHA_TAG
fi