diff --git a/Dockerfile b/Dockerfile index 6704dd080..f11e7c6ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,9 +8,15 @@ WORKDIR /src RUN go env -w GOCACHE=/go/.cache; \ go env -w GOMODCACHE=/go/pkg/mod +# We previously used --mount=type=bind in the next RUN command +# (see https://docs.docker.com/build/guide/mounts/#add-bind-mounts) +# but this did not work with SELinux volumes and Docker, as only +# Podman supports the relabel=shared option +# (see https://docs.podman.io/en/v4.4/markdown/options/mount.html). +# This adds a layer but works with Docker and Podman. +COPY go.mod go.sum ./ + RUN --mount=type=cache,target=/go/pkg/mod/ \ - --mount=type=bind,source=go.sum,target=go.sum \ - --mount=type=bind,source=go.mod,target=go.mod \ go mod download -x COPY . ./ diff --git a/Makefile b/Makefile index d60a76627..30b924268 100644 --- a/Makefile +++ b/Makefile @@ -497,12 +497,12 @@ docker/login: docker/login/fleet-manager .PHONY: docker/login docker/login/fleet-manager: - @docker logout quay.io + $(DOCKER) logout quay.io || true # Swallog podman error if not logged in @DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) login -u "${QUAY_USER}" --password-stdin <<< "${QUAY_TOKEN}" quay.io .PHONY: docker/login/fleet-manager docker/login/probe: - @docker logout quay.io + $(DOCKER) logout quay.io || true # Swallow podman error if not logged in @DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) login -u "${QUAY_PROBE_USER}" --password-stdin <<< "${QUAY_PROBE_TOKEN}" quay.io .PHONY: docker/login/probe @@ -563,7 +563,7 @@ image/push: image/push/fleet-manager image/push/probe image/push/fleet-manager: IMAGE_REF="$(external_image_registry)/$(image_repository):$(image_tag)" image/push/fleet-manager: - DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) buildx build -t $(IMAGE_REF) --platform $(IMAGE_PLATFORM) --push . + DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) buildx build -t $(IMAGE_REF) --platform $(IMAGE_PLATFORM) --output=type=registry . @echo @echo "Image was pushed as $(IMAGE_REF). You might want to" @echo "export FLEET_MANAGER_IMAGE=$(IMAGE_REF)" @@ -579,7 +579,7 @@ image/push/probe: image/build/probe # push the image to the OpenShift internal registry image/push/internal: IMAGE_TAG ?= $(image_tag) image/push/internal: docker/login/internal - $(DOCKER) buildx build -t "$(shell oc get route default-route -n openshift-image-registry -o jsonpath="{.spec.host}")/$(NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)" --platform linux/amd64 --push . + $(DOCKER) buildx build -t "$(shell oc get route default-route -n openshift-image-registry -o jsonpath="{.spec.host}")/$(NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)" --platform linux/amd64 --output=type=registry . .PHONY: image/push/internal image/build/fleetshard-operator: IMAGE_REF="$(external_image_registry)/fleetshard-operator:$(image_tag)" diff --git a/build_push_app_interface.sh b/build_push_app_interface.sh index 72eb10863..585867fcc 100755 --- a/build_push_app_interface.sh +++ b/build_push_app_interface.sh @@ -41,6 +41,7 @@ source ./scripts/build_setup.sh # Push the image: echo "Quay.io user and token is set, will push images to $IMAGE_REPOSITORY" make \ + DOCKER=podman \ DOCKER_CONFIG="${DOCKER_CONFIG}" \ QUAY_USER="${QUAY_USER}" \ QUAY_TOKEN="${QUAY_TOKEN}" \ @@ -51,6 +52,7 @@ make \ image/push/fleet-manager make \ + DOCKER=podman \ DOCKER_CONFIG="${DOCKER_CONFIG}" \ QUAY_USER="${QUAY_USER}" \ QUAY_TOKEN="${QUAY_TOKEN}" \ @@ -62,6 +64,7 @@ make \ image/push/fleet-manager make \ + DOCKER=podman \ DOCKER_CONFIG="${DOCKER_CONFIG}" \ QUAY_PROBE_USER="${QUAY_USER}" \ QUAY_PROBE_TOKEN="${QUAY_TOKEN}" \ @@ -72,6 +75,7 @@ make \ image/push/probe make \ + DOCKER=podman \ DOCKER_CONFIG="${DOCKER_CONFIG}" \ QUAY_PROBE_USER="${QUAY_USER}" \ QUAY_PROBE_TOKEN="${QUAY_TOKEN}" \ @@ -83,6 +87,7 @@ make \ image/push/probe make \ + DOCKER=podman \ DOCKER_CONFIG="${DOCKER_CONFIG}" \ QUAY_USER="${QUAY_USER}" \ QUAY_TOKEN="${QUAY_TOKEN}" \ @@ -93,6 +98,7 @@ make \ image/push/emailsender make \ + DOCKER=podman \ DOCKER_CONFIG="${DOCKER_CONFIG}" \ QUAY_USER="${QUAY_USER}" \ QUAY_TOKEN="${QUAY_TOKEN}" \ @@ -102,3 +108,4 @@ make \ emailsender_image_repository="${EMAILSENDER_IMAGE_REPOSITORY}" \ docker/login/fleet-manager \ image/push/emailsender +