Skip to content

Commit

Permalink
build: Use DOCKER_BUILDKIT also for non-dev cilium images
Browse files Browse the repository at this point in the history
Use DOCKER_BUILDKIT=1 also for the normal cilium image build, as well
as for Cilium operator, docker plugin, and hubble relay images.

Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
  • Loading branch information
jrajahalme committed May 13, 2020
1 parent 4e37a2b commit 232658f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 25 deletions.
63 changes: 38 additions & 25 deletions Makefile
Expand Up @@ -267,21 +267,6 @@ docker-cilium-image-for-developers:

docker-image: clean docker-image-no-clean docker-operator-image docker-plugin-image docker-hubble-relay-image

docker-image-no-clean: GIT_VERSION
$(QUIET)$(CONTAINER_ENGINE) build \
--build-arg LOCKDEBUG=${LOCKDEBUG} \
--build-arg V=${V} \
--build-arg LIBNETWORK_PLUGIN=${LIBNETWORK_PLUGIN} \
--build-arg CILIUM_SHA=$(firstword $(GIT_VERSION)) \
-t "cilium/cilium:$(DOCKER_IMAGE_TAG)" .
$(QUIET)$(CONTAINER_ENGINE) tag cilium/cilium:$(DOCKER_IMAGE_TAG) cilium/cilium:$(DOCKER_IMAGE_TAG)-${GOARCH}
$(QUIET)echo "Push like this when ready:"
$(QUIET)echo "${CONTAINER_ENGINE} push cilium/cilium:$(DOCKER_IMAGE_TAG)-${GOARCH}"

docker-cilium-manifest:
@$(ECHO_CHECK) contrib/scripts/push_manifest.sh cilium $(DOCKER_IMAGE_TAG)
$(QUIET) contrib/scripts/push_manifest.sh cilium $(DOCKER_IMAGE_TAG)

DOCKER_BUILDKIT =
DEV_DOCKERFILE_FILTER =
ifeq ($(DOCKER_DEV_NOCACHE),)
Expand Down Expand Up @@ -310,6 +295,22 @@ $(DEV_BUILD_DIR):
dev-build-update: check-status $(DEV_BUILD_DIR)
cd $(DEV_BUILD_DIR) && git fetch --depth=1 --no-tags && git reset --soft FETCH_HEAD

docker-image-no-clean: GIT_VERSION $(DEV_DOCKERFILE) dev-build-update
$(QUIET)$(DOCKER_BUILDKIT) $(CONTAINER_ENGINE) build -f $(DEV_DOCKERFILE) \
--build-arg LOCKDEBUG=${LOCKDEBUG} \
--build-arg V=${V} \
--build-arg GIT_CHECKOUT=1 \
--build-arg LIBNETWORK_PLUGIN=${LIBNETWORK_PLUGIN} \
--build-arg CILIUM_SHA=$(firstword $(GIT_VERSION)) \
-t "cilium/cilium:$(DOCKER_IMAGE_TAG)" $(DEV_BUILD_DIR)
$(QUIET)$(CONTAINER_ENGINE) tag cilium/cilium:$(DOCKER_IMAGE_TAG) cilium/cilium:$(DOCKER_IMAGE_TAG)-${GOARCH}
$(QUIET)echo "Push like this when ready:"
$(QUIET)echo "${CONTAINER_ENGINE} push cilium/cilium:$(DOCKER_IMAGE_TAG)-${GOARCH}"

docker-cilium-manifest:
@$(ECHO_CHECK) contrib/scripts/push_manifest.sh cilium $(DOCKER_IMAGE_TAG)
$(QUIET) contrib/scripts/push_manifest.sh cilium $(DOCKER_IMAGE_TAG)

dev-docker-image: GIT_VERSION $(DEV_DOCKERFILE) dev-build-update
$(QUIET)$(DOCKER_BUILDKIT) $(CONTAINER_ENGINE) build -f $(DEV_DOCKERFILE) \
--build-arg LOCKDEBUG=${LOCKDEBUG} \
Expand All @@ -326,25 +327,33 @@ docker-cilium-dev-manifest:
@$(ECHO_CHECK) contrib/scripts/push_manifest.sh cilium-dev $(DOCKER_IMAGE_TAG)
$(QUIET) contrib/scripts/push_manifest.sh cilium-dev $(DOCKER_IMAGE_TAG)

docker-operator-image: GIT_VERSION
$(QUIET)$(CONTAINER_ENGINE) build \
$(DEV_BUILD_DIR).%.Dockerfile: %.Dockerfile Makefile
-mkdir -p $(dir $@)
cat $< $(DEV_DOCKERFILE_FILTER) > $@

DEV_OPERATOR_DOCKERFILE := $(DEV_BUILD_DIR).cilium-operator.Dockerfile
docker-operator-image: GIT_VERSION $(DEV_OPERATOR_DOCKERFILE) dev-build-update
$(QUIET)$(DOCKER_BUILDKIT) $(CONTAINER_ENGINE) build \
--build-arg LOCKDEBUG=${LOCKDEBUG} \
--build-arg GIT_CHECKOUT=1 \
--build-arg CILIUM_SHA=$(firstword $(GIT_VERSION)) \
-f cilium-operator.Dockerfile \
-t "cilium/operator:$(DOCKER_IMAGE_TAG)" .
-f $(DEV_OPERATOR_DOCKERFILE) \
-t "cilium/operator:$(DOCKER_IMAGE_TAG)" $(DEV_BUILD_DIR)
$(QUIET)echo "Push like this when ready:"
$(QUIET)echo "${CONTAINER_ENGINE} push cilium/operator:$(DOCKER_IMAGE_TAG)-${GOARCH}"

docker-operator-manifest:
@$(ECHO_CHECK) contrib/scripts/push_manifest.sh operator $(DOCKER_IMAGE_TAG)
$(QUIET) contrib/scripts/push_manifest.sh operator $(DOCKER_IMAGE_TAG)

docker-plugin-image: GIT_VERSION
$(QUIET)$(CONTAINER_ENGINE) build \
DEV_PLUGIN_DOCKERFILE := $(DEV_BUILD_DIR).cilium-docker-plugin.Dockerfile
docker-plugin-image: GIT_VERSION $(DEV_PLUGIN_DOCKERFILE) dev-build-update
$(QUIET)$(DOCKER_BUILDKIT) $(CONTAINER_ENGINE) build \
--build-arg LOCKDEBUG=${LOCKDEUBG} \
--build-arg GIT_CHECKOUT=1 \
--build-arg CILIUM_SHA=$(firstword $(GIT_VERSION)) \
-f cilium-docker-plugin.Dockerfile \
-t "cilium/docker-plugin:$(DOCKER_IMAGE_TAG)" .
-f $(DEV_PLUGIN_DOCKERFILE) \
-t "cilium/docker-plugin:$(DOCKER_IMAGE_TAG)" $(DEV_BUILD_DIR)
$(QUIET)$(CONTAINER_ENGINE) tag cilium/docker-plugin:$(DOCKER_IMAGE_TAG) cilium/docker-plugin:$(DOCKER_IMAGE_TAG)-${GOARCH}
$(QUIET)echo "Push like this when ready:"
$(QUIET)echo "${CONTAINER_ENGINE} push cilium/docker-plugin:$(DOCKER_IMAGE_TAG)-${GOARCH}"
Expand All @@ -369,8 +378,12 @@ docker-cilium-builder-manifest:
@$(ECHO_CHECK) contrib/scripts/push_manifest.sh cilium-builder $(UTC_DATE)
$(QUIET) contrib/scripts/push_manifest.sh cilium-builder $(UTC_DATE)

docker-hubble-relay-image:
$(QUIET)$(CONTAINER_ENGINE) build -f hubble-relay.Dockerfile -t "cilium/hubble-relay:$(DOCKER_IMAGE_TAG)" .
DEV_HUBBLE_RELAY_DOCKERFILE := $(DEV_BUILD_DIR).hubble-relay.Dockerfile
docker-hubble-relay-image: $(DEV_HUBBLE_RELAY_DOCKERFILE) dev-build-update
$(QUIET)$(DOCKER_BUILDKIT) $(CONTAINER_ENGINE) build \
--build-arg GIT_CHECKOUT=1 \
-f $(DEV_HUBBLE_RELAY_DOCKERFILE) \
-t "cilium/hubble-relay:$(DOCKER_IMAGE_TAG)" $(DEV_BUILD_DIR)
$(QUIET)$(CONTAINER_ENGINE) tag cilium/hubble-relay:$(DOCKER_IMAGE_TAG) cilium/hubble-relay:$(DOCKER_IMAGE_TAG)-${GOARCH}
$(QUIET)echo "Push like this when ready:"
$(QUIET)echo "${CONTAINER_ENGINE} push cilium/hubble-relay:$(DOCKER_IMAGE_TAG)-${GOARCH}"
Expand Down
3 changes: 3 additions & 0 deletions cilium-docker-plugin.Dockerfile
@@ -1,10 +1,13 @@
#
FROM docker.io/library/golang:1.14.2 as builder
ARG CILIUM_SHA=""
LABEL cilium-sha=${CILIUM_SHA}
LABEL maintainer="maintainer@cilium.io"
ADD . /go/src/github.com/cilium/cilium
WORKDIR /go/src/github.com/cilium/cilium/plugins/cilium-docker
ARG LOCKDEBUG
ARG GIT_CHECKOUT
RUN test -z $GIT_CHECKOUT || git checkout
RUN make LOCKDEBUG=$LOCKDEBUG

FROM scratch
Expand Down
3 changes: 3 additions & 0 deletions cilium-operator.Dockerfile
@@ -1,10 +1,13 @@
#
FROM docker.io/library/golang:1.14.2 as builder
ARG CILIUM_SHA=""
LABEL cilium-sha=${CILIUM_SHA}
LABEL maintainer="maintainer@cilium.io"
ADD . /go/src/github.com/cilium/cilium
WORKDIR /go/src/github.com/cilium/cilium/operator
ARG LOCKDEBUG
ARG GIT_CHECKOUT
RUN test -z $GIT_CHECKOUT || git checkout
RUN make LOCKDEBUG=$LOCKDEBUG EXTRA_GO_BUILD_FLAGS="-tags operator_aws,operator_azure"

FROM docker.io/library/alpine:3.9.3 as certs
Expand Down
3 changes: 3 additions & 0 deletions hubble-relay.Dockerfile
@@ -1,6 +1,9 @@
#
FROM docker.io/library/golang:1.14.2 as builder
ADD . /go/src/github.com/cilium/cilium
WORKDIR /go/src/github.com/cilium/cilium/hubble-relay
ARG GIT_CHECKOUT
RUN test -z $GIT_CHECKOUT || git checkout
RUN make

FROM docker.io/library/alpine:3.11 as certs
Expand Down

0 comments on commit 232658f

Please sign in to comment.