Skip to content

Commit 4ed01f7

Browse files
committed
[no-relnote] Support PUSH_ON_BUILD for native images
Signed-off-by: Evan Lezar <[email protected]>
1 parent c008105 commit 4ed01f7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

deployments/container/native-only.mk

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,21 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
15+
PUSH_ON_BUILD ?= false
16+
ARCH ?= $(shell uname -m)
17+
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/$(ARCH)
18+
19+
ifeq ($(PUSH_ON_BUILD),true)
20+
$(BUILD_TARGETS): build-%: image-%
21+
$(DOCKER) push "$(IMAGE)"
22+
else
23+
$(BUILD_TARGETS): build-%: image-%
24+
endif
25+
26+
# For the default distribution we also retag the image.
27+
# Note: This needs to be updated for multi-arch images.
28+
ifeq ($(IMAGE_TAG),$(VERSION)-$(DIST))
29+
$(DEFAULT_PUSH_TARGET):
30+
$(DOCKER) image inspect $(IMAGE) > /dev/null || $(DOCKER) pull $(IMAGE)
31+
$(DOCKER) tag $(IMAGE) $(subst :$(IMAGE_TAG),:$(VERSION),$(IMAGE))
32+
endif

0 commit comments

Comments
 (0)