Skip to content

Commit

Permalink
Merge pull request #195 from Matthew-Beckett/hotfix/arm64
Browse files Browse the repository at this point in the history
Fix ARM64 compilation and improve image tag generation
  • Loading branch information
ahma authored Jan 7, 2023
2 parents 6a6f5b7 + ca0b53a commit ce37205
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
docker:
name: Docker
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -26,35 +27,33 @@ jobs:
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.ref }}
key: ${{ runner.os }}-buildx-${{ matrix.goarch }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-buildx-
${{ runner.os }}-buildx-${{ matrix.goarch }}-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Determine tag or commit
uses: haya14busa/action-cond@v1
id: refortag
- name: Docker meta for thanos-operator
id: thanos-operator-meta
uses: docker/metadata-action@v4
with:
cond: ${{ startsWith(github.ref, 'refs/tags/') }}
if_true: ${{ github.ref }}
if_false: latest
- name: Determine image tag
id: imagetag
run: echo "::set-output name=value::${TAG_OR_BRANCH##*/}"
env:
TAG_OR_BRANCH: ${{ steps.refortag.outputs.value }}
images: |
ghcr.io/${{ github.repository_owner }}/thanos-operator
banzaicloud/thanos-operator
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Build thanos-operator
uses: docker/build-push-action@v3
with:
Expand All @@ -63,8 +62,5 @@ jobs:
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
ghcr.io/banzaicloud/thanos-operator:${{ steps.imagetag.outputs.value }}
banzaicloud/thanos-operator:${{ steps.imagetag.outputs.value }}
tags: ${{ steps.thanos-operator-meta.outputs.tags }}
labels: ${{ steps.thanos-operator-meta.outputs.labels }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY controllers/ controllers/
COPY pkg/ pkg/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down

0 comments on commit ce37205

Please sign in to comment.