From 2076e48dfc573d6b78bc588f088c8a4c667601cb Mon Sep 17 00:00:00 2001 From: Rob Reus Date: Sun, 21 Jun 2020 21:02:37 +0200 Subject: [PATCH 1/5] Add builder stage for 'flux' binary Signed-off-by: Rob Reus --- build/flux/Dockerfile | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/build/flux/Dockerfile b/build/flux/Dockerfile index b2009b2a..a61b0cfb 100644 --- a/build/flux/Dockerfile +++ b/build/flux/Dockerfile @@ -1,7 +1,25 @@ -FROM alpine:3.11 +ARG VERSION=1.19.0 -ARG VERSION=1.18.0 -ARG TARGETPLATFORM +FROM golang:1.14-alpine as build + +ARG VERSION + +ENV GO111MODULE=on \ + CGO_ENABLED=0 + +RUN apk add --no-cache git + +WORKDIR /go/src/github.com/fluxcd/flux + +RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \ + export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \ + GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3); export GOARM=${GOARM:1} && \ + git clone --depth 1 -b ${VERSION} https://github.com/fluxcd/flux.git . && \ + go build -o fluxd -ldflags "-X main.version=${VERSION}" ./cmd/fluxd + +FROM alpine:3.12 + +ARG VERSION WORKDIR /home/flux @@ -11,9 +29,6 @@ RUN apk add --no-cache openssh-client curl ca-certificates tini git gnutls gnupg RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf ADD https://raw.githubusercontent.com/fluxcd/flux/${VERSION}/docker/kubectl.version /home/flux/kubectl.version -# ADD https://raw.githubusercontent.com/fluxcd/flux/${VERSION}/docker/kustomize.version /home/flux/kustomize.version -# ADD https://raw.githubusercontent.com/fluxcd/flux/${VERSION}/docker/sops.version /home/flux/sops.version - ADD https://raw.githubusercontent.com/fluxcd/flux/${VERSION}/docker/known_hosts.sh /home/flux/known_hosts.sh ADD https://raw.githubusercontent.com/fluxcd/flux/${VERSION}/docker/ssh_config /etc/ssh/ssh_config ADD https://raw.githubusercontent.com/fluxcd/flux/${VERSION}/docker/kubeconfig /root/.kube/config @@ -26,19 +41,20 @@ SHELL ["/bin/bash", "-c"] RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \ export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \ - GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3); export GOARM=${GOARM:1} && \ export KUBECTL_VERSION=$(echo "$(cut -d'=' -f2 <<< $(grep KUBECTL_VERSION /home/flux/kubectl.version))") && \ curl -L -o /usr/local/bin/kubectl "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${GOARCH}/kubectl" && \ chmod +x /usr/local/bin/kubectl && \ curl -L -o /usr/local/bin/fluxctl "https://github.com/fluxcd/flux/releases/download/${VERSION}/fluxctl_linux_${GOARCH}" && \ chmod +x /usr/local/bin/fluxctl -COPY --from=raspbernetes/fluxd:1.18.0 /usr/local/bin/fluxd /usr/local/bin/fluxd +COPY --from=build /go/src/github.com/fluxcd/flux/fluxd /usr/local/bin/fluxd RUN chmod +x /usr/local/bin/fluxd +# from: https://raw.githubusercontent.com/fluxcd/flux/${VERSION}/docker/kustomize.version COPY --from=raspbernetes/kustomize:v3.5.5 /usr/local/bin/kustomize /usr/local/bin/kustomize RUN chmod +x /usr/local/bin/kustomize +# from: https://raw.githubusercontent.com/fluxcd/flux/${VERSION}/docker/sops.version COPY --from=raspbernetes/sops:v3.5.0 /usr/local/bin/sops /usr/local/bin/sops RUN chmod +x /usr/local/bin/sops From 5ea58a0b7f0c43ecf99d2e6a3b95ebbc5145c7f4 Mon Sep 17 00:00:00 2001 From: Rob Reus Date: Sun, 21 Jun 2020 21:03:13 +0200 Subject: [PATCH 2/5] Removing obsolete 'fluxd' image Signed-off-by: Rob Reus --- .github/workflows/fluxd.yml | 53 ------------------------------------- README.md | 1 - build/fluxd/.version | 1 - build/fluxd/Dockerfile | 25 ----------------- build/fluxd/README.md | 3 --- 5 files changed, 83 deletions(-) delete mode 100644 .github/workflows/fluxd.yml delete mode 100644 build/fluxd/.version delete mode 100644 build/fluxd/Dockerfile delete mode 100644 build/fluxd/README.md diff --git a/.github/workflows/fluxd.yml b/.github/workflows/fluxd.yml deleted file mode 100644 index 327b4dcf..00000000 --- a/.github/workflows/fluxd.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: fluxd - -on: - push: - paths: - - '.github/workflows/fluxd.yml' - - 'build/fluxd/**' - - '!build/fluxd/*.md' - -jobs: - build: - runs-on: ubuntu-latest - env: - VERSION: $(cat build/fluxd/.version) - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - id: buildx - uses: crazy-max/ghaction-docker-buildx@v1 - with: - buildx-version: latest - - - name: Login to GitHub Docker Registry - run: echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Build Container Image - if: github.ref != 'refs/heads/master' - run: | - docker buildx build \ - --platform linux/amd64,linux/arm64,linux/arm/v7 \ - --build-arg=VERSION=${{ env.VERSION }} \ - --tag raspbernetes/fluxd:${{ github.sha }} \ - -f ./build/fluxd/Dockerfile \ - ./build/fluxd/ \ - --push - - - name: Build Container Image - if: github.ref == 'refs/heads/master' - run: | - docker buildx build \ - --platform linux/amd64,linux/arm64,linux/arm/v7 \ - --build-arg=VERSION=${{ env.VERSION }} \ - --tag raspbernetes/fluxd:latest \ - --tag raspbernetes/fluxd:${{ env.VERSION }} \ - --tag k8sathome/fluxd:${{ env.VERSION }} \ - -f ./build/fluxd/Dockerfile \ - ./build/fluxd/ \ - --push diff --git a/README.md b/README.md index ee443687..6af0c3f0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ This repository is only used to store the unofficial docker images that will be | sops | [![Docker Pulls](https://img.shields.io/docker/pulls/raspbernetes/sops)](https://hub.docker.com/r/raspbernetes/sops) | `arm/arm64/amd64` | [![GitHub issue status](https://img.shields.io/github/issues/detail/state/mozilla/sops/595)](https://github.com/mozilla/sops/issues/595)| | kustomize | [![Docker Pulls](https://img.shields.io/docker/pulls/raspbernetes/kustomize)](https://hub.docker.com/r/raspbernetes/kustomize) | `arm/arm64/amd64` | [![GitHub issue status](https://img.shields.io/github/issues/detail/state/kubernetes-sigs/kustomize/2235)](https://github.com/kubernetes-sigs/kustomize/issues/2235)| | flux | [![Docker Pulls](https://img.shields.io/docker/pulls/raspbernetes/flux)](https://hub.docker.com/r/raspbernetes/flux) | `arm/arm64/amd64` | [![GitHub issue status](https://img.shields.io/github/issues/detail/state/fluxcd/flux/1761)](https://github.com/fluxcd/flux/issues/1761)| -| fluxd | [![Docker Pulls](https://img.shields.io/docker/pulls/raspbernetes/fluxd)](https://hub.docker.com/r/raspbernetes/fluxd) | `arm/arm64/amd64` | N/A| | velero-aws-plugin | [![Docker Pulls](https://img.shields.io/docker/pulls/raspbernetes/velero-aws-plugin)](https://hub.docker.com/r/raspbernetes/velero-aws-plugin) | `arm/arm64/amd64` | [![GitHub issue status](https://img.shields.io/github/issues/detail/state/vmware-tanzu/velero-plugin-for-aws/18)](https://github.com/vmware-tanzu/velero-plugin-for-aws/issues/18)| | velero-gcp-plugin | [![Docker Pulls](https://img.shields.io/docker/pulls/raspbernetes/velero-gcp-plugin)](https://hub.docker.com/r/raspbernetes/velero-gcp-plugin) | `arm/arm64/amd64` | N/A| | apcupsd-exporter | [![Docker Pulls](https://img.shields.io/docker/pulls/raspbernetes/apcupsd-exporter)](https://hub.docker.com/r/raspbernetes/apcupsd-exporter) | `arm/arm64/amd64` | N/A | diff --git a/build/fluxd/.version b/build/fluxd/.version deleted file mode 100644 index 84cc5294..00000000 --- a/build/fluxd/.version +++ /dev/null @@ -1 +0,0 @@ -1.18.0 diff --git a/build/fluxd/Dockerfile b/build/fluxd/Dockerfile deleted file mode 100644 index 6197a679..00000000 --- a/build/fluxd/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM golang:1.14-alpine as build - -ARG VERSION=1.18.0 -ARG BUILDPLATFORM - -ENV GO111MODULE=on \ - CGO_ENABLED=0 - -RUN apk add --no-cache git - -WORKDIR /go/src/github.com/fluxcd/flux - -RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \ - export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \ - GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3); export GOARM=${GOARM:1} && \ - git clone --depth 1 -b ${VERSION} https://github.com/fluxcd/flux.git . && \ - go build -o fluxd ./cmd/fluxd - -# Use distroless as minimal base image to package the manager binary -# Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot - -COPY --from=build /go/src/github.com/fluxcd/flux/fluxd /usr/local/bin/fluxd - -USER nonroot:nonroot diff --git a/build/fluxd/README.md b/build/fluxd/README.md deleted file mode 100644 index bb155fed..00000000 --- a/build/fluxd/README.md +++ /dev/null @@ -1,3 +0,0 @@ -![fluxd](https://github.com/raspbernetes/multi-arch-images/workflows/fluxd/badge.svg) - -# Fluxd From de9fe39eb1d98c1eb53f7bf65bbb9bbec10a1fc8 Mon Sep 17 00:00:00 2001 From: Rob Reus Date: Sun, 21 Jun 2020 21:03:25 +0200 Subject: [PATCH 3/5] Removing unused Makefile Signed-off-by: Rob Reus --- Makefile | 57 -------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index a551321a..00000000 --- a/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -SHELL := /bin/bash -o pipefail - -CONTAINER_CLI ?= docker - -LOCAL_ARCH ?= $(shell uname -m) -ifeq ($(LOCAL_ARCH),x86_64) - TARGET_ARCH ?= amd64 - BUILDX ?= amd64 -else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv8) - TARGET_ARCH ?= arm64 - BUILDX ?= arm64 -else ifeq ($(LOCAL_ARCH),aarch64) - TARGET_ARCH ?= arm64 - BUILDX ?= arm64 -else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv7) - TARGET_ARCH ?= arm - BUILDX ?= arm/v7 -else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv6) - TARGET_ARCH ?= arm - BUILDX ?= arm/v6 -else - $(error This system's architecture $(LOCAL_ARCH) isn't supported) -endif - - -LOCAL_OS ?= $(shell uname) -ifeq ($(LOCAL_OS),Linux) - TARGET_OS ?= linux - READLINK_FLAGS="-f" -else ifeq ($(LOCAL_OS),Darwin) - TARGET_OS ?= darwin - READLINK_FLAGS="" -else - $(error This system's OS $(LOCAL_OS) isn't supported) -endif - -TAG ?= $(shell git rev-parse --verify HEAD) -ifeq ($(TAG),) - $(error "TAG cannot be empty") -endif - -FLUX_VERSION ?= 1.18.0 -KUSTOMIZE_VERSION ?= v3.5.4 -SOPS_VERSION ?= v3.5.0 -KUBECTL_VERSION ?= v1.15.9 - -.PHONY: flux -flux: - $(CONTAINER_CLI) buildx build \ - --platform $(TARGET_OS)/$(BUILDX) \ - --build-arg=GOOS=$(TARGET_OS) \ - --build-arg=GOARCH=$(TARGET_ARCH) \ - --build-arg=FLUX_VERSION=$(FLUX_VERSION) \ - --build-arg=KUBECTL_VERSION=$(KUBECTL_VERSION) \ - --file build/flux/Dockerfile \ - --tag xunholy/flux:$(TAG) \ - ./build/flux/ --push From 2d0bd6140f0e5280d8e7d1d64deaa0e16b5c316e Mon Sep 17 00:00:00 2001 From: Rob Reus Date: Sun, 21 Jun 2020 21:03:44 +0200 Subject: [PATCH 4/5] Adding '.idea' to '.gitignore' Signed-off-by: Rob Reus --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1378d9c3..6b530270 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build/istio/* .DS_Store +.idea From ddbafb5bbe69ba27b98a20e5856b2d1026e60587 Mon Sep 17 00:00:00 2001 From: Rob Reus Date: Sun, 21 Jun 2020 23:34:16 +0200 Subject: [PATCH 5/5] Restoring flux ARG TARGETPLATFORM which was inadvertently removed Signed-off-by: Rob Reus --- build/flux/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/flux/Dockerfile b/build/flux/Dockerfile index a61b0cfb..39bcdaa9 100644 --- a/build/flux/Dockerfile +++ b/build/flux/Dockerfile @@ -3,6 +3,7 @@ ARG VERSION=1.19.0 FROM golang:1.14-alpine as build ARG VERSION +ARG TARGETPLATFORM ENV GO111MODULE=on \ CGO_ENABLED=0 @@ -20,6 +21,7 @@ RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \ FROM alpine:3.12 ARG VERSION +ARG TARGETPLATFORM WORKDIR /home/flux