diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b0fbe9c6f..e361d7dbe 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -29,9 +29,11 @@ jobs: strategy: fail-fast: false matrix: - platform: - - linux/amd64 - - linux/arm64 + os: + - linux + arch: + - amd64 + - arm64 steps: - name: Checkout @@ -43,6 +45,17 @@ jobs: images: ${{ env.REGISTRY_IMAGE }} tags: ${{ env.TAGS_CONFIG }} + # Build executable + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.20' + - name: Build + run: make static + env: + GOOS: ${{ matrix.os }} + GOARCH: ${{ matrix.arch }} + # Setup buildx - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -71,7 +84,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . - platforms: ${{ matrix.platform }} + platforms: ${{ matrix.os }}/${{ matrix.arch }} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }} diff --git a/.github/workflows/publish-page.yml b/.github/workflows/publish-page.yml index 3bad19bf8..caf8ee0f6 100644 --- a/.github/workflows/publish-page.yml +++ b/.github/workflows/publish-page.yml @@ -5,12 +5,16 @@ on: push: branches: - main + paths: + - docs/** pull_request: types: - opened - reopened - synchronize - closed + paths: + - docs/** permissions: contents: write diff --git a/Dockerfile b/Dockerfile index d290ff989..abb0d027d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ # download kubectl -FROM golang:1.21.3-alpine as kubectl -RUN apk add --no-cache curl +FROM golang:1.21.3 as kubectl RUN export VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) &&\ export OS=$(go env GOOS) && \ export ARCH=$(go env GOARCH) &&\ @@ -8,14 +7,11 @@ RUN export VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/r chmod +x /usr/local/bin/kubectl # build jsonnet-bundler -FROM golang:1.21.3-alpine as jb -WORKDIR /tmp -RUN apk add --no-cache git make bash &&\ - git clone https://github.com/jsonnet-bundler/jsonnet-bundler &&\ - ls /bin &&\ - cd jsonnet-bundler &&\ - make static &&\ - mv _output/jb /usr/local/bin/jb +FROM golang:1.21.3 as jb +RUN export OS=$(go env GOOS) &&\ + export ARCH=$(go env GOARCH) &&\ + curl -o /usr/local/bin/jb -L "https://github.com/jsonnet-bundler/jsonnet-bundler/releases/download/v0.5.1/jb-${OS}-${ARCH}" &&\ + chmod +x /usr/local/bin/jb FROM golang:1.21.3-alpine as helm WORKDIR /tmp/helm @@ -39,15 +35,11 @@ RUN export TAG=$(curl --silent "https://api.github.com/repos/kubernetes-sigs/kus curl -SL "https://github.com/kubernetes-sigs/kustomize/releases/download/${TAG}/kustomize_${VERSION_TAG}_${OS}_${ARCH}.tar.gz" > kustomize.tgz && \ tar -xvf kustomize.tgz -FROM golang:1.21.3 as build -WORKDIR /app -COPY . . -RUN make static - # assemble final container FROM alpine:3.18 RUN apk add --no-cache coreutils diffutils less git openssh-client -COPY --from=build /app/tk /usr/local/bin/tk +# Need to `make static` before building the container +COPY tk /usr/local/bin/tk COPY --from=kubectl /usr/local/bin/kubectl /usr/local/bin/kubectl COPY --from=jb /usr/local/bin/jb /usr/local/bin/jb COPY --from=helm /tmp/helm/helm /usr/local/bin/helm