Skip to content

Commit

Permalink
Adding buildx to docker image building (#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
gracegoo-stripe committed Nov 21, 2022
1 parent 9f048ca commit eb29333
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/test-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Running goreleaser with the snapshot flag allows us to run some custom validations
# on our build without publishing: https://goreleaser.com/customization/snapshots/

name: test-snapshot

on:
push:
paths:
- '.goreleaser/**'
pull_request:
paths:
- 'goreleaser/**'

jobs:
build-linux:
runs-on: ubuntu-latest
env:
# https://goreleaser.com/customization/docker_manifest/
DOCKER_CLI_EXPERIMENTAL: "enabled"

steps:
- name: Code checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Docker Login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Run GoReleaser Snapshot
uses: goreleaser/goreleaser-action@v2
with:
version: v0.184.0
args: release -f .goreleaser/linux.yml --rm-dist --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACTORY_SECRET: ${{ secrets.ARTIFACTORY_SECRET }}
8 changes: 6 additions & 2 deletions .goreleaser/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ nfpms:
formats:
- rpm
dockers:
- goos: linux
- use: buildx
goos: linux
goarch: amd64
ids:
- stripe
Expand All @@ -81,7 +82,9 @@ dockers:
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=repository=https://github.com/stripe/stripe-cli"
- "--label=homepage=https://stripe.com"
- goos: linux
- "--platform=linux/amd64"
- use: buildx
goos: linux
goarch: arm64
ids:
- stripe
Expand All @@ -97,6 +100,7 @@ dockers:
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=repository=https://github.com/stripe/stripe-cli"
- "--label=homepage=https://stripe.com"
- "--platform=linux/arm64/v8"
docker_manifests:
- name_template: "stripe/stripe-cli:latest"
image_templates:
Expand Down

0 comments on commit eb29333

Please sign in to comment.