Skip to content

Commit c474c97

Browse files
authored
Merge 2186828 into 2c57498
2 parents 2c57498 + 2186828 commit c474c97

File tree

5 files changed

+77
-31
lines changed

5 files changed

+77
-31
lines changed

Makefile

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ LOCAL_BUILD_FLAGS ?= $(BUILD_FLAGS)
1212
LDFLAGS ?= -X=main.version=$(VERSION)
1313
DOCKERDIR = docker
1414

15-
IMAGE ?= registry.opensource.zalan.do/acid/$(BINARY)
15+
BASE_IMAGE ?= alpine:latest
16+
IMAGE ?= $(BINARY)
1617
TAG ?= $(VERSION)
1718
GITHEAD = $(shell git rev-parse --short HEAD)
1819
GITURL = $(shell git config --get remote.origin.url)
@@ -42,8 +43,9 @@ ifndef GOPATH
4243
GOPATH := $(HOME)/go
4344
endif
4445

45-
PATH := $(GOPATH)/bin:$(PATH)
46-
SHELL := env PATH="$(PATH)" $(SHELL)
46+
PATH := $(GOPATH)/bin:$(PATH)
47+
SHELL := env PATH="$(PATH)" $(SHELL)
48+
IMAGE_TAG := $(IMAGE):$(TAG)$(CDP_TAG)$(DEBUG_FRESH)$(DEBUG_POSTFIX)
4749

4850
default: local
4951

@@ -66,13 +68,25 @@ docker: ${DOCKERDIR}/${DOCKERFILE}
6668
echo "Version ${VERSION}"
6769
echo "CDP tag ${CDP_TAG}"
6870
echo "git describe $(shell git describe --tags --always --dirty)"
69-
docker build --rm -t "$(IMAGE):$(TAG)$(CDP_TAG)$(DEBUG_FRESH)$(DEBUG_POSTFIX)" -f "${DOCKERDIR}/${DOCKERFILE}" --build-arg VERSION="${VERSION}" .
71+
docker build --rm -t "$(IMAGE_TAG)" -f "${DOCKERDIR}/${DOCKERFILE}" --build-arg VERSION="${VERSION}" --build-arg BASE_IMAGE="${BASE_IMAGE}" .
7072

7173
indocker-race:
7274
docker run --rm -v "${GOPATH}":"${GOPATH}" -e GOPATH="${GOPATH}" -e RACE=1 -w ${PWD} golang:1.25.3 bash -c "make linux"
7375

74-
push:
75-
docker push "$(IMAGE):$(TAG)$(CDP_TAG)"
76+
docker-push:
77+
echo `(env)`
78+
echo "Tag ${TAG}"
79+
echo "Version ${VERSION}"
80+
echo "CDP tag ${CDP_TAG}"
81+
echo "git describe $(shell git describe --tags --always --dirty)"
82+
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
83+
docker buildx build --platform "linux/amd64,linux/arm64" \
84+
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
85+
--build-arg VERSION="${VERSION}" \
86+
-t "$(IMAGE_TAG)" \
87+
-f "${DOCKERDIR}/${DOCKERFILE}" \
88+
--push .
89+
echo "$(IMAGE_TAG)"
7690

7791
mocks:
7892
GO111MODULE=on go generate ./...

delivery.yaml

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
version: "2017-09-20"
2+
allow_concurrent_steps: true
3+
4+
build_env: &BUILD_ENV
5+
PYTHON_BASE_IMAGE: container-registry.zalando.net/library/python-3.11-slim
6+
ALPINE_BASE_IMAGE: container-registry.zalando.net/library/alpine-3.15
7+
MULTI_ARCH_REGISTRY: container-registry-test.zalando.net/acid
8+
29
pipeline:
310
- id: build-postgres-operator
11+
env:
12+
<<: *BUILD_ENV
413
type: script
514
vm_config:
615
type: linux
@@ -17,17 +26,21 @@ pipeline:
1726
1827
- desc: Build Docker image
1928
cmd: |
20-
IS_PR_BUILD=${CDP_PULL_REQUEST_NUMBER+"true"}
21-
if [[ ${CDP_TARGET_BRANCH} == "master" && ${IS_PR_BUILD} != "true" ]]
22-
then
23-
IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator
29+
if [ -z ${CDP_SOURCE_BRANCH} ]; then
30+
IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator
2431
else
25-
IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator-test
32+
IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator-test
33+
fi
34+
35+
IMAGE_TAG=$(make docker-push IMAGE=${IMAGE} BASE_IMAGE=${ALPINE_BASE_IMAGE})
36+
37+
if [ -z ${CDP_SOURCE_BRANCH} ]; then
38+
cdp-promote-image ${IMAGE_TAG}
2639
fi
27-
export IMAGE
28-
make docker push
2940
3041
- id: build-operator-ui
42+
env:
43+
<<: *BUILD_ENV
3144
type: script
3245
vm_config:
3346
type: linux
@@ -46,18 +59,21 @@ pipeline:
4659
- desc: 'Build and push Docker image'
4760
cmd: |
4861
cd ui
49-
IS_PR_BUILD=${CDP_PULL_REQUEST_NUMBER+"true"}
50-
if [[ ${CDP_TARGET_BRANCH} == "master" && ${IS_PR_BUILD} != "true" ]]
51-
then
52-
IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator-ui
62+
if [ -z ${CDP_SOURCE_BRANCH} ]; then
63+
IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator-ui
5364
else
54-
IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator-ui-test
65+
IMAGE=${MULTI_ARCH_REGISTRY}/postgres-operator-ui-test
66+
fi
67+
68+
IMAGE_TAG=$(make docker-push IMAGE=${IMAGE} BASE_IMAGE=${PYTHON_BASE_IMAGE})
69+
70+
if [ -z ${CDP_SOURCE_BRANCH} ]; then
71+
cdp-promote-image ${IMAGE_TAG}
5572
fi
56-
export IMAGE
57-
make docker
58-
make push
5973
6074
- id: build-logical-backup
75+
env:
76+
<<: *BUILD_ENV
6177
type: script
6278
vm_config:
6379
type: linux
@@ -67,6 +83,11 @@ pipeline:
6783
cmd: |
6884
cd logical-backup
6985
export TAG=$(git describe --tags --always --dirty)
70-
IMAGE="registry-write.opensource.zalan.do/acid/logical-backup"
71-
docker build --rm -t "$IMAGE:$TAG$CDP_TAG" .
72-
docker push "$IMAGE:$TAG$CDP_TAG"
86+
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
87+
docker buildx build --platform linux/amd64,linux/arm64 \
88+
-t ${MULTI_ARCH_REGISTRY}/postgres-operator-logical-backup:${TAG} \
89+
--push .
90+
91+
if [ -z ${CDP_SOURCE_BRANCH} ]; then
92+
cdp-promote-image ${MULTI_ARCH_REGISTRY}/postgres-operator-logical-backup:${TAG}
93+
fi

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BASE_IMAGE=registry.opensource.zalan.do/library/alpine-3:latest
1+
ARG BASE_IMAGE=alpine:latest
22
FROM golang:1.25-alpine AS builder
33
ARG VERSION=latest
44

ui/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BASE_IMAGE=registry.opensource.zalan.do/library/python-3.11-slim:latest
1+
ARG BASE_IMAGE=python:3.11-slim
22
ARG NODE_IMAGE=node:lts-alpine
33

44
FROM $NODE_IMAGE AS build

ui/Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.PHONY: clean test appjs docker push mock
22

3-
IMAGE ?= registry.opensource.zalan.do/acid/postgres-operator-ui
3+
IMAGE ?= postgres-operator-ui
4+
BASE_IMAGE ?= python:3.11-slim
45
VERSION ?= $(shell git describe --tags --always --dirty)
56
TAG ?= $(VERSION)
67
GITHEAD = $(shell git rev-parse --short HEAD)
@@ -30,10 +31,20 @@ docker: appjs
3031
echo "Version ${VERSION}"
3132
echo "CDP tag ${CDP_TAG}"
3233
echo "git describe $(shell git describe --tags --always --dirty)"
33-
docker build --rm -t "$(IMAGE):$(TAG)$(CDP_TAG)" -f Dockerfile .
34-
35-
push:
36-
docker push "$(IMAGE):$(TAG)$(CDP_TAG)"
34+
docker build --rm -t "$(IMAGE):$(TAG)$(CDP_TAG)" -f Dockerfile --build-arg BASE_IMAGE="${BASE_IMAGE}" .
3735

36+
docker-push: appjs
37+
echo "Tag ${TAG}"
38+
echo "Version ${VERSION}"
39+
echo "CDP tag ${CDP_TAG}"
40+
echo "git describe $(shell git describe --tags --always --dirty)"
41+
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
42+
docker buildx build --platform linux/amd64,linux/arm64 \
43+
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
44+
-f Dockerfile \
45+
-t "$(IMAGE):$(TAG)$(CDP_TAG)" \
46+
--push .
47+
echo "$(IMAGE):$(TAG)$(CDP_TAG)"
48+
3849
mock:
3950
docker run -it -p 8081:8081 "$(IMAGE):$(TAG)" --mock

0 commit comments

Comments
 (0)