Skip to content

build linux docker image with amd64 and arm64 #6

build linux docker image with amd64 and arm64

build linux docker image with amd64 and arm64 #6

Workflow file for this run

name: Create Release
on:
push:
tags:
- "v*.*.*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: |
go install github.com/swaggo/swag/cmd/swag@latest
swag init
env GOOS=darwin GOARCH=arm64 go build -ldflags "-w -s" -o logicng-service-macos-arm main.go
env GOOS=darwin GOARCH=amd64 go build -ldflags "-w -s" -o logicng-service-macos-intel main.go
env GOOS=linux GOARCH=amd64 go build -ldflags "-w -s" -o logicng-service-linux-amd64 main.go
env GOOS=linux GOARCH=arm64 go build -ldflags "-w -s" -o logicng-service-linux-arm64 main.go
env GOOS=windows GOARCH=amd64 go build -ldflags "-w -s" -o logicng-service-win.exe main.go
- name: Build and Push AMD64 Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/booleworks/logicng-service:$(echo ${{ github.ref }} | cut -c 12-)
platforms: linux/amd64
buildargs: PLATFORM=linux-amd64
- name: Build and Push ARM64 Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/booleworks/logicng-service:$(echo ${{ github.ref }} | cut -c 12-)
platforms: linux/arm64
buildargs: PLATFORM=linux-arm64
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
logicng-service-macos-arm
logicng-service-macos-amd
logicng-service-linux
logicng-service-win.exe