Skip to content

Commit 4916dd7

Browse files
committed
Switch from buildx to build
1 parent 7f4a653 commit 4916dd7

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

bin/build

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ buildImage() {
105105
repo="$OWNER/$IMAGE"
106106

107107
buildMultiArchImage "$IMAGE" "$repo:latest"
108+
pushImage "$repo:latest"
109+
108110
buildMultiArchImage "$IMAGE" "$repo:$major_tag"
111+
pushImage "$repo:$major_tag"
112+
109113
if [[ "$IMAGE" = "php" ]]; then
110114
updatePatchVersion
111115
fi
@@ -114,14 +118,17 @@ buildImage() {
114118
latest_tag="$patch_tag-$(date '+%Y-%m-%d-%H-%M-%S')"
115119

116120
buildMultiArchImage "$IMAGE" "$repo:$minor_tag"
121+
pushImage "$repo:$minor_tag"
122+
117123
buildMultiArchImage "$IMAGE" "$repo:$patch_tag"
124+
pushImage "$repo:$patch_tag"
125+
118126
buildMultiArchImage "$IMAGE" "$repo:$latest_tag"
127+
pushImage "$repo:$latest_tag"
119128
}
120129

121130
#######################################
122-
# Builds and pushes a multi-arch image
123-
#
124-
# Ideally this should just build and not push, but buildx does not currently support loading.
131+
# Builds a multi-arch image
125132
#
126133
# Arguments:
127134
# 1 the image to build. Must have a matching .docker file in the root of the project.
@@ -131,17 +138,29 @@ buildImage() {
131138
# MINOR_VERSION the minor PHP version to build images for
132139
#######################################
133140
buildMultiArchImage() {
141+
local image="$1"
134142
local tag="$2"
135143

136144
out.info.ln ""
137-
out.info.ln "Building $1 multi-arch image with tag '$2'"
138-
shell.command.retry docker buildx build --push --platform linux/arm64/v8,linux/amd64 -f "$1.docker" \
139-
--build-arg PHP_VERSION="$MAJOR_VERSION.$MINOR_VERSION" -t "$tag" . > "logs/$1.log" 2>&1
140-
out.success.ln "Successfully built & pushed multi-arch image with tag '$tag'"
141-
142-
log.info "Pulling multi-arch image '$tag' since buildx does not support loading currently."
143-
log.info 'We will likely need this image as the base for the next one.'
144-
shell.command.retry docker image pull "$tag"
145+
out.info.ln "Building $image multi-arch image with tag '$tag'"
146+
shell.command.retry docker build --platform linux/arm64/v8,linux/amd64 -f "$image.docker" \
147+
--build-arg PHP_VERSION="$MAJOR_VERSION.$MINOR_VERSION" -t "$tag" . > "logs/$image.log" 2>&1
148+
out.success.ln "Successfully built multi-arch image with tag '$tag'"
149+
}
150+
151+
152+
#######################################
153+
# Pushes an image
154+
#
155+
# Arguments:
156+
# 1 the tag of the image to push
157+
#######################################
158+
pushImage() {
159+
local tag="$1"
160+
161+
out.info.ln "Pushing image '$tag'"
162+
shell.command.retry docker push "$tag"
163+
out.success.ln "Successfully pushed '$tag'"
145164
}
146165

147166
#######################################

0 commit comments

Comments
 (0)