-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve multi-platform production image build + publish (#182)
- Loading branch information
James Halsall
authored
Nov 29, 2021
1 parent
b14a6a4
commit 4f6c31d
Showing
7 changed files
with
41 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
function destroy() { | ||
run docker-compose down --rmi local --volumes --remove-orphans | ||
|
||
if [ "{{ @('docker.experimental.multiplatform_build.enabled') }}" == "yes" ]; then | ||
run docker buildx rm "{{ @('namespace') }}" || true | ||
fi | ||
|
||
passthru ws cleanup built-images | ||
run rm -f .my127ws/.flag-built | ||
} | ||
|
||
destroy |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
#!/bin/bash | ||
|
||
function docker_publish() { | ||
echo '{{ @('docker.registry.password') }}' | run docker login --username='{{ @('docker.registry.username') }}' --password-stdin '{{ @('docker.registry.url') }}' | ||
local registryUrl=$1 | ||
local username=$2 | ||
local password=$3 | ||
|
||
echo "${password}" | run docker login --username="${username}" --password-stdin "${registryUrl}" | ||
|
||
if [ "{{ @('docker.experimental.multiplatform_build.enabled') }}" == "yes" ]; then | ||
passthru docker buildx bake --file docker-bake.hcl --push | ||
else | ||
run docker push {{ @('docker.repository') }}:{{ @('docker.tagPrefix')}}{{ @('app.version') }} | ||
{% for tag in @('docker.production.additional_tags') %} | ||
{% for tag in @('docker.production.additional_tags') %} | ||
run docker push {{ @('docker.repository') }}:{{ @('docker.tagPrefix')}}{{ tag }} | ||
{% endfor %} | ||
{% endfor %} | ||
fi | ||
|
||
run docker logout {{ @('docker.registry.url') }} | ||
} | ||
|
||
docker_publish | ||
docker_publish "$1" "$2" "$3" |