Skip to content

Commit

Permalink
Use mirrored buildx for PRs Only (#4753)
Browse files Browse the repository at this point in the history
* test docker install for buildx

* remove unneeded inline script

* changed PRs to use cached image

* fix pipeline parameter issue
  • Loading branch information
mikaelweave authored Dec 17, 2024
1 parent 946142e commit 4848f21
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions build/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ stages:
parameters:
tag: $(build.BuildNumber)
buildPlatform: $(publicDockerImagePlatforms)
multiplePlatforms: true
1 change: 1 addition & 0 deletions build/ci-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ stages:
parameters:
tag: $(ImageTag)
buildPlatform: $(publicDockerImagePlatforms)
multiplePlatforms: true

- stage: provisionEnvironment
displayName: Provision Environment
Expand Down
1 change: 1 addition & 0 deletions build/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ stages:
parameters:
tag: $(ImageTag)
buildPlatform: $(publicDockerImagePlatforms)
multiplePlatforms: true

# *********************** Stu3 ***********************
- stage: redeployStu3
Expand Down
6 changes: 6 additions & 0 deletions build/jobs/docker-build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,34 @@ parameters:
type: string
- name: buildPlatform
type: string
- name: multiplePlatforms
type: boolean

jobs:
- template: docker-build-push.yml
parameters:
version: "R4"
tag: ${{parameters.tag}}
buildPlatform: ${{parameters.buildPlatform}}
multiplePlatforms: ${{parameters.multiplePlatforms}}

- template: docker-build-push.yml
parameters:
version: "R4B"
tag: ${{parameters.tag}}
buildPlatform: ${{parameters.buildPlatform}}
multiplePlatforms: ${{parameters.multiplePlatforms}}

- template: docker-build-push.yml
parameters:
version: "Stu3"
tag: ${{parameters.tag}}
buildPlatform: ${{parameters.buildPlatform}}
multiplePlatforms: ${{parameters.multiplePlatforms}}

- template: docker-build-push.yml
parameters:
version: "R5"
tag: ${{parameters.tag}}
buildPlatform: ${{parameters.buildPlatform}}
multiplePlatforms: ${{parameters.multiplePlatforms}}
10 changes: 9 additions & 1 deletion build/jobs/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ parameters:
type: string
- name: buildPlatform
type: string
- name: multiplePlatforms
type: boolean

jobs:
- job: '${{parameters.version}}_Docker'
Expand All @@ -22,7 +24,13 @@ jobs:
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
docker pull mirror.gcr.io/moby/buildkit:buildx-stable-1
if [ "${{ parameters.multiplePlatforms }}" = "true" ]; then
echo "Running multi-platform build. Will pull buildx from dockerhub."
else
echo "Running single-platform build, pulling buildx from mirror to avoid throttling."
docker pull mirror.gcr.io/moby/buildkit:buildx-stable-1
fi
TAG="$(azureContainerRegistry)/${{parameters.version}}_fhir-server:${{parameters.tag}}"
az acr login --name $(azureContainerRegistryName)
docker buildx create --name fhir-multi-platform --platform ${{parameters.buildPlatform}} --use --bootstrap
Expand Down
1 change: 1 addition & 0 deletions build/pr-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ stages:
parameters:
tag: $(ImageTag)
buildPlatform: $(testDockerImagePlatforms)
multiplePlatforms: false

- stage: provisionEnvironment
displayName: Provision Environment
Expand Down

0 comments on commit 4848f21

Please sign in to comment.