Skip to content

Commit

Permalink
Remove last DOCKER_BUILDKIT=0
Browse files Browse the repository at this point in the history
* "--network" is somehow not supported by the new builder, see moby/buildkit#978
* anyway, during our builds this process does not makes much sense anymore (especially as we don't find release candidates on the download servers)
* if you've used this locally, just provide the package manually

Change-Id: Ic6af45d28ec7d154c11f17f9f2b291e626fba928
JIRA-Ref: CMK-12974
(cherry picked from commit 5abe9a34a123ed458bbf612983ac5634f462ffa5)
  • Loading branch information
TimotheusBachinger committed May 16, 2023
1 parent c41d58f commit 62f5b84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
14 changes: 2 additions & 12 deletions docker_image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ ARG CMK_VERSION="2.2.0b8"
# Choose one of: raw, enterprise, managed
ARG CMK_EDITION="raw"

ARG CMK_DL_URL="https://download.checkmk.com/checkmk"

# The following variables can be set during container init (docker run -e KEY=val)
ARG CMK_SITE_ID
ENV CMK_SITE_ID="cmk"
Expand All @@ -30,11 +28,6 @@ ARG DISTRO_CODENAME="jammy"
# Used e.g. for omd update
ENV CMK_CONTAINERIZED="TRUE"

# The credentials for the download are provided by a sidecar container. For
# local builds it is convenient to change this (e.g. to the docker host and
# running `python -m http.simple`)
ARG CREDENTIALS_URL="http://127.0.0.1:8000/secret"

# Make the list of required packages available to the following command
COPY needed-packages /needed-packages

Expand Down Expand Up @@ -84,11 +77,8 @@ RUN set -e \
&& PKG_NAME="check-mk-${CMK_EDITION}-${CMK_VERSION}" \
&& PKG_FILE="${PKG_NAME}_0.${DISTRO_CODENAME}_$(dpkg --print-architecture).deb" \
&& if [ ! -e "/${PKG_FILE}" ]; then \
echo "Receive download credentials from ${CREDENTIALS_URL}..." && \
CMK_DL_CREDENTIALS=$(curl -fsS "${CREDENTIALS_URL}") && \
echo "Downloading ${PKG_FILE}..." && \
echo "--user \"${CMK_DL_CREDENTIALS}\"" \
| curl -f -o "${PKG_FILE}" -K - "${CMK_DL_URL}/${CMK_VERSION}/${PKG_FILE}" ; \
echo "ERROR: Please provide ${PKG_FILE} by downloading it from https://download.checkmk.com/checkmk" \
&& return 1 ; \
fi \
&& gpg -q --import "/Check_MK-pubkey.gpg" \
&& gpg --verify "${PKG_FILE}" \
Expand Down
14 changes: 2 additions & 12 deletions docker_image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@

include ../defines.make

CREDENTIALS_FILE := $$HOME/.cmk-credentials
DOCKER_REPO_NAME := checkmk
SHELL := /bin/bash -e -o pipefail
RESOLVE_CMD := ../buildscripts/docker_image_aliases/resolve.py
SECRET_CONTAINER_ID_CMD := docker run -d --rm \
--volume $(CREDENTIALS_FILE):/files/secret \
$$($(RESOLVE_CMD) IMAGE_BUSYBOX_LATEST) timeout 180 httpd -f -p 8000 -h /files

.PHONY: help setup setversion image image-daily clean test-lint-dockerfile test-lint-entrypoint

Expand Down Expand Up @@ -59,18 +55,14 @@ image: needed-packages
echo "VERSION_TAG is not set, please pass this environment variable during make target call."; \
exit 1; \
fi; \
SECRET_CONTAINER_ID=$$($(SECRET_CONTAINER_ID_CMD)) ; \
DOCKER_BUILDKIT=0 docker build \
--network=container:$$SECRET_CONTAINER_ID \
docker build \
--build-arg CMK_VERSION="$(VERSION)" \
--build-arg CMK_EDITION="$(EDITION)" \
--build-arg IMAGE_CMK_BASE=$$($(RESOLVE_CMD) IMAGE_CMK_BASE) \
-t $(DOCKER_REPO_NAME)/check-mk-$(EDITION):$(VERSION_TAG) \
. ; \
docker stop $$SECRET_CONTAINER_ID

image-daily: needed-packages
SECRET_CONTAINER_ID=$$($(SECRET_CONTAINER_ID_CMD)) ; \
BRANCH_PREFIX="$$(git rev-parse --abbrev-ref HEAD)" ; \
if [[ "$$BRANCH_PREFIX" == "master" || "$$BRANCH_PREFIX" =~ "/" ]]; then \
BRANCH_PREFIX="" ; \
Expand All @@ -79,15 +71,13 @@ image-daily: needed-packages
fi ; \
VERSION="$${VERSION:-$$(date +%F)}" ; \
VERSION="$${BRANCH_PREFIX}$${VERSION//-/.}" ; \
DOCKER_BUILDKIT=0 docker build \
--network=container:$$SECRET_CONTAINER_ID \
docker build \
--build-arg CMK_VERSION="$${VERSION}" \
--build-arg CMK_EDITION=$(EDITION) \
--build-arg IMAGE_CMK_BASE=$$($(RESOLVE_CMD) IMAGE_CMK_BASE) \
-t $(DOCKER_REPO_NAME)/check-mk-$(EDITION):$${VERSION} \
-t $(DOCKER_REPO_NAME)/check-mk-$(EDITION):$${BRANCH_PREFIX}daily \
. ; \
docker stop $$SECRET_CONTAINER_ID

test-lint-dockerfile:
docker run --rm -i $$($(RESOLVE_CMD) IMAGE_HADOLINT) < Dockerfile
Expand Down

0 comments on commit 62f5b84

Please sign in to comment.