Skip to content

Commit

Permalink
feat: arm64/amd64 support for docker images (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
flabatut committed Mar 21, 2024
1 parent c4f7019 commit f95b1f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -34,6 +34,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
Expand All @@ -53,5 +59,6 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
5 changes: 4 additions & 1 deletion Dockerfile
Expand Up @@ -2,13 +2,16 @@ FROM golang:1.21-alpine AS build

LABEL MAINTAINER = 'Friends of Go (it@friendsofgo.tech)'

ARG TARGETOS=linux
ARG TARGETARCH=amd64

RUN apk add --update git
RUN apk add ca-certificates
WORKDIR /go/src/github.com/friendsofgo/killgrave
COPY . .
RUN go mod tidy && TAG=$(git describe --tags --abbrev=0) \
&& LDFLAGS=$(echo "-s -w -X github.com/friendsofgo/killgrave/internal/app/cmd._version="docker-$TAG) \
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /go/bin/killgrave -ldflags "$LDFLAGS" cmd/killgrave/main.go
&& CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" go build -a -installsuffix cgo -o /go/bin/killgrave -ldflags "$LDFLAGS" cmd/killgrave/main.go

# Building image with the binary
FROM scratch
Expand Down

0 comments on commit f95b1f4

Please sign in to comment.