This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
40 lines (27 loc) · 1.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# This repo's root import path (under GOPATH).
PKG := github.com/drud/golang-build-container
# Docker repo for a push
DOCKER_ORG ?= drud
DOCKER_REPO ?= golang-build-container
DEFAULT_IMAGES = golang-build-container
VERSION := $(shell git describe --tags --always --dirty)
DOCKER_BUILDKIT=1
# Tests always run against amd64 (build host). Once tests have passed, a multi-arch build
# will be generated and pushed (the amd64 build will be cached automatically to prevent it from building twice).
BUILD_ARCHS=linux/amd64,linux/arm64
include containers_shared.mak
container build: images
images: $(DEFAULT_IMAGES)
push:
set -eu -o pipefail; \
for item in $(DEFAULT_IMAGES); do \
docker buildx build --push --platform $(BUILD_ARCHS) --label com.ddev.buildhost=${shell hostname} -t $(DOCKER_ORG)/$$item:$(VERSION) $(DOCKER_ARGS) . ; \
echo "pushed $(DOCKER_ORG)/$$item"; \
done
golang-build-container:
docker buildx build -o type=docker --label com.ddev.buildhost=${shell hostname} -t $(DOCKER_ORG)/$@:$(VERSION) $(DOCKER_ARGS) .
test: images
set -eu -o pipefail; \
for item in $(DEFAULT_IMAGES); do \
if [ -x tests/$$item/test.sh ]; then tests/$$item/test.sh $(DOCKER_ORG)/$$item:$(VERSION); fi; \
done