Skip to content

Commit

Permalink
feat: push cache separately when multi platform
Browse files Browse the repository at this point in the history
workaround: docker/buildx#1044
  • Loading branch information
jobcespedes committed Jun 26, 2022
1 parent 869a752 commit dada729
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ external_release_version_regex: ^([0-9]+)\.([0-9]+)\.([0-9]+)
# build vars
dockerfile_builder: docker
dockerfile_builder_use_buildx: true
dockerfile_builder_buildx_multiplatform_cache: false
dockerfile_builder_platforms:
- 'linux/amd64'
- 'linux/arm64'
Expand Down
2 changes: 1 addition & 1 deletion .ansible-ci/roles/dockerfile_builder
6 changes: 3 additions & 3 deletions .ansible-ci/tasks/builder/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
set_fact:
dockerfile_builder_cache_from:
"{{ dockerfile_builder_cache_from | default([]) +
[cache_image +
':' + item] }}"
[cache_image + ':' + item] }}"

- name: set cache build args variables
when:
Expand Down Expand Up @@ -72,4 +71,5 @@
cache_separate_image_name_tag: "{{ cache_image }}:build-cache"
set_fact:
dockerfile_builder_cache_from: "{{ [cache_separate_image_name_tag] }}"
dockerfile_builder_cache_to: "{{ [cache_separate_image_name_tag] }}"
dockerfile_builder_cache_to: "{{ ['type=' + dockerfile_builder_cache_to_type | default('registry') +
',mode=' + dockerfile_builder_cache_to_mode | default('max') + ',ref=' + cache_separate_image_name_tag] }}"
2 changes: 1 addition & 1 deletion .ansible-ci/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repo_owner: "{{ lookup('env','REPO_OWNER') | default('krestomatio',true) }}"
repo_name: "{{ lookup('env','REPO_NAME') | default('container_builder',true) }}"
project_registry_path: "{{ repo_owner+'/'+repo_name }}"
build_cache: true
build_cache: "{{ not dockerfile_builder_buildx_multiplatform_cache | default(false) }}"
build_cache_prepull: "{{ false if dockerfile_builder_use_buildx else true }}"
build_cache_first_prepull: true
build_push: "{{ lookup('env','BUILD_PUSH') | default(true,true) }}"
Expand Down

0 comments on commit dada729

Please sign in to comment.