Skip to content

Commit 0ab1e78

Browse files
Makefile updates (#409)
Signed-off-by: Anders Swanson <[email protected]>
1 parent f1d82ab commit 0ab1e78

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

Makefile

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARCH_TYPE ?= $(subst x86_64,amd64,$(patsubst i%86,386,$(ARCH)))
44
GOOS ?= $(shell go env GOOS)
55
GOARCH ?= $(shell go env GOARCH)
66
TAGS ?= godror
7+
PLATFORM ?= amd64
78
DOCKER_TARGET ?= exporter-godror
89
CGO_ENABLED ?= 1
910
VERSION ?= 2.2.0
@@ -91,11 +92,24 @@ clean:
9192
push-images:
9293
@make --no-print-directory push-oraclelinux-image
9394

94-
docker:
95-
docker build --no-cache --target=$(DOCKER_TARGET) --progress=plain $(BUILD_ARGS) -t "$(IMAGE_ID)-amd64" --build-arg BASE_IMAGE=$(ORACLE_LINUX_BASE_IMAGE) --build-arg GOARCH=amd64 .
95+
docker: docker-amd
9696

9797
docker-arm:
98-
docker buildx build --target=$(DOCKER_TARGET) --platform linux/arm64 --load --no-cache --progress=plain $(BUILD_ARGS) -t "$(IMAGE_ID)-arm64" --build-arg BASE_IMAGE=$(ORACLE_LINUX_BASE_IMAGE) --build-arg GOARCH=arm64 .
98+
@$(MAKE) PLATFORM=arm64 docker-platform
99+
100+
docker-amd:
101+
@$(MAKE) PLATFORM=amd64 docker-platform
102+
103+
docker-platform:
104+
@echo "Building Docker image for $(PLATFORM)..."
105+
docker build --no-cache --target=$(DOCKER_TARGET) \
106+
--platform linux/$(PLATFORM) \
107+
--progress=plain $(BUILD_ARGS) \
108+
-t "$(IMAGE_ID)-$(PLATFORM)" \
109+
--build-arg BASE_IMAGE=$(ORACLE_LINUX_BASE_IMAGE) \
110+
--build-arg GOARCH=$(PLATFORM) \
111+
--build-arg CGO_ENABLED=$(CGO_ENABLED) \
112+
--build-arg TAGS=$(TAGS) .
99113

100114
push-oraclelinux-image:
101115
docker push $(IMAGE_ID)
@@ -112,4 +126,5 @@ podman-push:
112126

113127
podman-release: podman-build podman-push
114128

115-
.PHONY: version build deps go-test clean docker podman-build podman-push podman-release
129+
.PHONY: version build deps go-test clean docker docker-arm docker-platform docker-amd \
130+
podman-build podman-push podman-release

build-all-macos.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ build_ol() {
6767

6868
if [[ -n "$BUILD_CONTAINERS" ]]; then
6969
echo "Starting $OL_IMAGE-${platform} build container"
70-
docker build --platform "linux/${platform}" --target=exporter-$TARGET -t $image_artifact \
71-
--build-arg GO_VERSION=$GO_VERSION --build-arg TAGS=$TAGS --build-arg CGO_ENABLED=$CGO_ENABLED \
72-
--build-arg BASE_IMAGE=$BASE_IMAGE --build-arg GOARCH=$platform --build-arg GOOS=linux --build-arg VERSION=$VERSION .
70+
PLATFORM=$platform make docker-platform
7371
fi
7472

7573
if [[ -n "BUILD_OL8" ]]; then

0 commit comments

Comments
 (0)