Skip to content

Commit

Permalink
build: Add new multi-platform operator image
Browse files Browse the repository at this point in the history
This intial version includes all operator falavours, since
parametrisation needs some more work to be fully integrated,
and it's better to avoid duplication of Dockerfiles.

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
  • Loading branch information
errordeveloper authored and aanm committed Jul 3, 2020
1 parent 12c70c8 commit efc7d4b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
33 changes: 33 additions & 0 deletions images/operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# syntax=docker/dockerfile:1.1-experimental

# Copyright 2020 Authors of Cilium
# SPDX-License-Identifier: Apache-2.0

ARG CILIUM_BUILDER_IMAGE=docker.io/cilium/cilium-builder-dev:b030f1ed16c21608d78564124a870a18ca485444
ARG CA_CERTIFICATES_IMAGE=docker.io/cilium/ca-certificates:69a9f5d66ff96bf97e8b9dc107e92aa9ddbdc9a8

FROM --platform=linux/amd64 ${CILIUM_BUILDER_IMAGE} as builder

ARG NOSTRIP
ARG LOCKDEBUG

RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/cilium --mount=target=/root/.cache,type=cache --mount=target=/go/pkg/mod,type=cache \
make -C operator \
NOSTRIP=$NOSTRIP LOCKDEBUG=$LOCKDEBUG PKG_BUILD=1 \
&& mkdir -p /out/linux/amd64/usr/bin && mv operator/cilium-operator* /out/linux/amd64/usr/bin

RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/cilium --mount=target=/root/.cache,type=cache --mount=target=/go/pkg/mod,type=cache \
env GOARCH=arm64 \
make -C operator \
NOSTRIP=$NOSTRIP LOCKDEBUG=$LOCKDEBUG PKG_BUILD=1 \
&& mkdir -p /out/linux/arm64/usr/bin && mv operator/cilium-operator* /out/linux/arm64/usr/bin


FROM ${CA_CERTIFICATES_IMAGE}
ARG TARGETPLATFORM
LABEL maintainer="maintainer@cilium.io"

COPY --from=builder /out/${TARGETPLATFORM} /

WORKDIR /
CMD ["/usr/bin/cilium-operator-generic"]
22 changes: 22 additions & 0 deletions images/operator/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2020 Authors of Cilium
# SPDX-License-Identifier: Apache-2.0

# since this is image is built with root context, most of the files
# need to be excluded for faster builds and to avoid spoiling build
# cache due to unchecked files (like configs or random binaries)
*

# must-have toplevel files
!/Makefile*
!/go.sum
!/go.mod
!/VERSION
# TODO: this is currently a make dependency, but should be removed
# in the future
!/Dockerfile

# directories
!/api
!/pkg
!/vendor
!/operator

0 comments on commit efc7d4b

Please sign in to comment.