A buildspec for CodeBuild... for cross platform building with buildx - enjoy :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.2 | |
phases: | |
install: | |
runtime-versions: | |
docker: 19 | |
commands: | |
- docker version | |
- curl -JLO https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64 | |
- mkdir -p ~/.docker/cli-plugins | |
- mv buildx-v0.4.2.linux-amd64 ~/.docker/cli-plugins/docker-buildx | |
- chmod a+rx ~/.docker/cli-plugins/docker-buildx | |
- docker run --privileged --rm tonistiigi/binfmt --install all | |
pre_build: | |
commands: | |
- echo Logging in to Amazon ECR... | |
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com | |
build: | |
commands: | |
- echo Build started on `date` | |
- echo Building the Docker image... | |
- docker buildx create --use --name crossx | |
- docker buildx build --push --platform=linux/amd64,linux/arm64 -t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG . |
i assume that the old version here is due to the ancient docker version in codebuild.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!