Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Oct 13, 2023
1 parent ff9dd78 commit b4cb33d
Showing 1 changed file with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ version: 2.1
commands:
install-docker-buildx:
description: Install Docker Buildx
parameters:
docker-tag:
type: string
buildx-version:
type: string
default: v0.11.2
steps:
- run:
name: Install Docker Buildx
command: |
mkdir -vp ~/.docker/cli-plugins/
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.10.4/buildx-v0.10.4.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
curl --silent -L "https://github.com/docker/buildx/releases/download/<< parameters.buildx-version >>/buildx-<< parameters.buildx-version >>.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
docker buildx version
sudo apt-get update && sudo apt-get install -y binfmt-support qemu-user-static
docker run --rm --privileged tonistiigi/binfmt --install arm64
docker context create buildcontext
docker buildx create buildcontext --use
docker buildx create --name joyful-<< parameters.docker-tag >>- --append buildcontext --use
executors:
docker-publisher:
Expand All @@ -29,7 +35,7 @@ jobs:
steps:
- checkout
- setup_remote_docker:
version: 20.10.18
version: 20.10.24
docker_layer_caching: true
- run:
name: "Test with terratest"
Expand All @@ -51,9 +57,6 @@ jobs:
- run:
name: Log time
command: date
- run:
name: Get Rate Limit
command: ./compile.sh rate
- run:
name: Gen Docker file
command: |
Expand All @@ -71,10 +74,8 @@ jobs:
cat ${BUILD_FOLDER}/$file
echo ""
done
- install-docker-buildx
- run:
name: login
command: ./compile.sh login
- install-docker-buildx:
docker-tag: << parameters.docker-tag >>
- run:
name: build Docker image
command: |
Expand All @@ -84,7 +85,7 @@ jobs:
IMAGE_NAME=$(DOCKER_HUB=1 support/remoteImage.sh)
BUILD_VERSION=<< parameters.docker-tag >>
BUILD_FOLDER=${VER_PREFIX}-<< parameters.docker-tag >>
BUILD_ARG=""
BUILD_ARG="--build-arg BUILDKIT_INLINE_CACHE=1"
LATEST_TAG=""
if [ "x$VERSION" == "x$BUILD_VERSION" ]; then
if [ -n "${ALT_VERSION}" ]; then
Expand All @@ -93,9 +94,17 @@ jobs:
LATEST_TAG="-t $IMAGE_NAME:latest"
fi
echo "Build ARGS: ${BUILD_ARG}"
docker pull $IMAGE_NAME:${BUILD_VERSION} || true
docker buildx inspect --bootstrap
docker buildx build ${BUILD_ARG} -f ${BUILD_FOLDER}/Dockerfile \
echo "# ------ Start to Login ------ #"
./compile.sh login
./compile.sh rate
echo "# ------ End to Login ------ #"
DOCKER_BUILDKIT=1 docker buildx build ${BUILD_ARG} -f ${BUILD_FOLDER}/Dockerfile \
--cache-to=type=inline,mode=all \
--cache-from $IMAGE_NAME:${BUILD_VERSION} \
--push \
--progress=plain \
--platform linux/amd64,linux/arm64/v8 \
-t $IMAGE_NAME:${BUILD_VERSION} ${LATEST_TAG} \
./${BUILD_FOLDER}
Expand Down

0 comments on commit b4cb33d

Please sign in to comment.