From e0f104310b8b824e0529c0c601fbec012da3550d Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Mon, 16 Sep 2024 15:28:09 +0200 Subject: [PATCH] Fix builds with podman; align default tagging --- Makefile | 4 ++-- README.md | 4 ++-- contrib/docker/Dockerfile | 9 +++------ contrib/opentelemetry/flp.yml | 2 +- docs/confGenerator.md | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 4d8285033..e342b4eaa 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ export GOOS=linux # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= latest +VERSION ?= main BUILD_DATE := $(shell date +%Y-%m-%d\ %H:%M) TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1) TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true) @@ -60,7 +60,7 @@ FORCE: ; # build a single arch target provided as argument define build_target echo 'building image for arch $(1)'; \ - DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETPLATFORM=linux/$(1) --build-arg TARGETARCH=$(1) --build-arg BUILDPLATFORM=linux/amd64 ${OCI_BUILD_OPTS} -t ${IMAGE}-$(1) -f contrib/docker/Dockerfile .; + DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETARCH=$(1) ${OCI_BUILD_OPTS} -t ${IMAGE}-$(1) -f contrib/docker/Dockerfile .; endef # push a single arch target image diff --git a/README.md b/README.md index 5c9fc7a43..4ca444be6 100644 --- a/README.md +++ b/README.md @@ -898,10 +898,10 @@ The `suppressGoMetrics` parameter may be set to `true` in order to suppress the # compile project make build - # build the default image (quay.io/netobserv/flowlogs-pipeline:latest): + # build the default image (quay.io/netobserv/flowlogs-pipeline:main): make image-build - # push the default image (quay.io/netobserv/flowlogs-pipeline:latest): + # push the default image (quay.io/netobserv/flowlogs-pipeline:main): make image-push # build and push on your own quay.io account (quay.io/myuser/flowlogs-pipeline:dev): diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 96a49bf9a..41bd8bdd3 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -1,9 +1,6 @@ -# We do not use --platform feature to auto fill this ARG because of incompatibility between podman and docker -ARG TARGETPLATFORM=linux/amd64 -ARG BUILDPLATFORM=linux/amd64 -FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 as builder +ARG TARGETARCH +FROM docker.io/library/golang:1.22 as builder -ARG TARGETPLATFORM ARG TARGETARCH=amd64 WORKDIR /app @@ -22,7 +19,7 @@ RUN git status --porcelain RUN GOARCH=$TARGETARCH make build_code # final stage -FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi-minimal:9.4 +FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi-minimal:9.4 COPY --from=builder /app/flowlogs-pipeline /app/ COPY --from=builder /app/confgenerator /app/ diff --git a/contrib/opentelemetry/flp.yml b/contrib/opentelemetry/flp.yml index de0927688..73e93cca1 100644 --- a/contrib/opentelemetry/flp.yml +++ b/contrib/opentelemetry/flp.yml @@ -68,7 +68,7 @@ spec: serviceAccountName: netobserv containers: - name: packet-counter - image: quay.io/netobserv/flowlogs-pipeline:latest + image: quay.io/netobserv/flowlogs-pipeline:main ports: - containerPort: 9999 hostPort: 9999 diff --git a/docs/confGenerator.md b/docs/confGenerator.md index a3eacaf88..35ba77ad8 100644 --- a/docs/confGenerator.md +++ b/docs/confGenerator.md @@ -33,7 +33,7 @@ Flags: ``` > Note: confgenerator is available also from `netobserv/flowlogs-pipeline` quay image. To use execute: -> `docker run --entrypoint /app/confgenerator quay.io/netobserv/flowlogs-pipeline:latest --help` +> `docker run --entrypoint /app/confgenerator quay.io/netobserv/flowlogs-pipeline:main --help` > Note: The default location for network definitions in flowlogs-pipeline is `/network_definitions` folder