Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build multi-arch k8s-helm image #89

Merged
merged 1 commit into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,37 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Build Helm container
uses: docker/build-push-action@v1
- name: Build and test Helm container
run: |
GIT_BRANCH=${GITHUB_REF#refs/heads/} make docker_build
GIT_BRANCH=${GITHUB_REF#refs/heads/} make test
- name: Docker meta
if: ${{ startsWith(github.ref, 'refs/heads/m') || startsWith(github.ref, 'refs/heads/v') }}
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: lachlanevenson/k8s-helm
add_git_labels: true
tag_with_ref: true
push: false
- name: Test Helm container
run: GIT_BRANCH=${GITHUB_REF#refs/heads/} make test
- name: Publish Helm container
images: lachlanevenson/k8s-helm
tag-semver: |
{{raw}}
- name: Set up QEMU
if: ${{ startsWith(github.ref, 'refs/heads/m') || startsWith(github.ref, 'refs/heads/v') }}
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
if: ${{ startsWith(github.ref, 'refs/heads/m') || startsWith(github.ref, 'refs/heads/v') }}
uses: docker/build-push-action@v1
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: ${{ startsWith(github.ref, 'refs/heads/m') || startsWith(github.ref, 'refs/heads/v') }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: lachlanevenson/k8s-helm
tag_with_ref: true
add_git_labels: true
- name: Build and publish multi-arch Helm container
if: ${{ startsWith(github.ref, 'refs/heads/m') || startsWith(github.ref, 'refs/heads/v') }}
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/s390x,linux/arm64,linux/ppc64le
push: true
tags: |
${{ github.ref != 'refs/heads/master' && steps.docker_meta.outputs.tags || '' }}
${{ github.ref == 'refs/heads/master' && 'lachlanevenson/k8s-helm:latest' || '' }}
labels: ${{ steps.docker_meta.outputs.labels }}
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ LABEL org.opencontainers.image.title="lachlanevenson/k8s-helm" \

ENV HELM_LATEST_VERSION="v3.5.0"

ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH:-amd64}

RUN apk add --update ca-certificates \
&& apk add --update -t deps wget git openssl bash \
&& wget -q https://get.helm.sh/helm-${HELM_LATEST_VERSION}-linux-amd64.tar.gz \
&& tar -xf helm-${HELM_LATEST_VERSION}-linux-amd64.tar.gz \
&& mv linux-amd64/helm /usr/local/bin \
&& wget -q https://get.helm.sh/helm-${HELM_LATEST_VERSION}-linux-${TARGETARCH}.tar.gz \
&& tar -xf helm-${HELM_LATEST_VERSION}-linux-${TARGETARCH}.tar.gz \
&& mv linux-${TARGETARCH}/helm /usr/local/bin \
&& apk del --purge deps \
&& rm /var/cache/apk/* \
&& rm -f /helm-${HELM_LATEST_VERSION}-linux-amd64.tar.gz
&& rm -f /helm-${HELM_LATEST_VERSION}-linux-${TARGETARCH}.tar.gz

ENTRYPOINT ["helm"]
CMD ["help"]