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

feat: build Docker images for ARMv7 and ARM64v8 architectures [v8] #291

Merged
merged 2 commits into from
Feb 9, 2024
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
10 changes: 10 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ inputs:
runs:
using: composite
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/386
- name: Git clean
shell: bash
run: git clean -f
- name: Login to Docker
shell: bash
run: |
echo $DOCKER_TOKEN | docker login --username $DOCKER_USERNAME --password-stdin
- name: Run Goreleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,24 @@ jobs:


security-scan:
needs: go-versions
runs-on: ubuntu-latest
name: "Trivy Scan of Docker Image"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: 'true'
- name: Setup Go ${{ inputs.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ needs.go-versions.outputs.latest }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/386
- name: Build Docker Images
run: make products-for-release
- uses: aquasecurity/trivy-action@master
Expand Down
90 changes: 81 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ builds:
- darwin
- linux
goarch: # Goreleaser's default for this is 386 + amd64, but let's be explicit
- 386
- '386'
- amd64
- arm
- arm64
goarm:
- "7"
ignore: # Go 1.15+ doesn't support 32-bit Darwin
- goos: darwin
goarch: 386
goarch: '386'

nfpms:
-
Expand Down Expand Up @@ -59,15 +63,83 @@ release:
# (we want Releaser to be responsible for doing all the GitHub release manipulations)

dockers:
# i386
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}"
- "launchdarkly/ld-relay:v{{ .Major }}"
- "launchdarkly/ld-relay:latest"
- "launchdarkly/ld-relay:{{ .Version }}-i386"
- "launchdarkly/ld-relay:v{{ .Major }}-i386"
- "launchdarkly/ld-relay:latest-i386"
use: buildx
goos: linux
goarch: '386'
dockerfile: Dockerfile.goreleaser
skip_push: false
build_flag_templates:
- "--pull"
- "--platform=linux/386"

# AMD64
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-amd64"
- "launchdarkly/ld-relay:v{{ .Major }}-amd64"
- "launchdarkly/ld-relay:latest-amd64"
use: buildx
goos: linux
goarch: amd64
dockerfile: Dockerfile.goreleaser
skip_push: false
# If your Dockerfile copies files other than the binary itself,
# you should list them here as well.
# extra_files:
# - filename
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"

# ARMv7
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-armv7"
- "launchdarkly/ld-relay:v{{ .Major }}-armv7"
- "launchdarkly/ld-relay:latest-armv7"
use: buildx
goos: linux
goarch: arm
goarm: 7
dockerfile: Dockerfile.goreleaser
skip_push: false
build_flag_templates:
- "--pull"
- "--platform=linux/arm/v7"

# ARM64v8
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-arm64v8"
- "launchdarkly/ld-relay:v{{ .Major }}-arm64v8"
- "launchdarkly/ld-relay:latest-arm64v8"
use: buildx
goos: linux
goarch: arm64
dockerfile: Dockerfile.goreleaser
skip_push: false
build_flag_templates:
- "--pull"
- "--platform=linux/arm64/v8"
docker_manifests:
- name_template: "launchdarkly/ld-relay:{{ .Version}}"
skip_push: false
image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-amd64"
- "launchdarkly/ld-relay:{{ .Version }}-armv7"
- "launchdarkly/ld-relay:{{ .Version }}-arm64v8"
- "launchdarkly/ld-relay:{{ .Version }}-i386"

- name_template: "launchdarkly/ld-relay:v{{ .Major }}"
skip_push: false
image_templates:
- "launchdarkly/ld-relay:v{{ .Major }}-amd64"
- "launchdarkly/ld-relay:v{{ .Major }}-armv7"
- "launchdarkly/ld-relay:v{{ .Major }}-arm64v8"
- "launchdarkly/ld-relay:v{{ .Major }}-i386"

- name_template: "launchdarkly/ld-relay:latest"
skip_push: false
image_templates:
- "launchdarkly/ld-relay:latest-amd64"
- "launchdarkly/ld-relay:latest-armv7"
- "launchdarkly/ld-relay:latest-arm64v8"
- "launchdarkly/ld-relay:latest-i386"
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# syntax=docker/dockerfile:1

# This is a standalone Dockerfile that does not depend on goreleaser building the binary
# It is NOT the version that is pushed to dockerhub
FROM golang:1.21.6-alpine3.19 as builder
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ publish:
./scripts/run-goreleaser.sh

products-for-release:
./scripts/run-goreleaser.sh --skip-publish --skip-validate
./scripts/run-goreleaser.sh --skip=publish --skip=validate

DOCKER_COMPOSE_TEST=docker-compose -f docker-compose.test.yml

Expand Down
Loading
Loading