Skip to content

Commit

Permalink
build linux docker image with amd64 and arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
SHildebrandt committed May 24, 2024
1 parent 330c242 commit 6f8ccd3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
29 changes: 23 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
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:
Expand All @@ -26,13 +30,26 @@ jobs:
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-amd main.go
env GOOS=linux GOARCH=amd64 go build -ldflags "-w -s" -o logicng-service-linux 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 Docker Image
run: |
docker build . -t ghcr.io/booleworks/logicng-service:$(echo ${{ github.ref }} | cut -c 12-)
docker push ghcr.io/booleworks/logicng-service:$(echo ${{ github.ref }} | cut -c 12-)
- 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:
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
ARG PLATFORM
FROM alpine:latest
LABEL org.opencontainers.image.source=https://github.com/booleworks/logicng-service

ENV TIMEOUT 5s

COPY logicng-service-linux /opt/logicng-service
COPY logicng-service-$PLATFORM /opt/logicng-service

EXPOSE 8080
CMD /opt/logicng-service --timeout $TIMEOUT

0 comments on commit 6f8ccd3

Please sign in to comment.