Skip to content

Commit 5352ab5

Browse files
committed
Build an arm64 container image
1 parent eeab653 commit 5352ab5

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
FROM golang:1.18.3 as builder
1+
FROM --platform=${BUILDPLATFORM} golang:1.18.3 as builder
2+
ARG TARGETARCH
3+
ARG TARGETOS
24
WORKDIR /go/src/github.com/max-rocket-internet/k8s-event-logger
35
COPY . .
46
RUN go get
5-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o k8s-event-logger
7+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o k8s-event-logger
68
RUN adduser --disabled-login --no-create-home --disabled-password --system --uid 101 non-root
79

8-
FROM alpine:3.15.4
10+
FROM --platform=${TARGETPLATFORM} alpine:3.15.4
911
RUN addgroup -S non-root && adduser -S -G non-root non-root
1012
USER 101
1113
ENV USER non-root

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
VERSION ?= 1.6.1
2+
IMG ?= maxrocketinternet/k8s-event-logger:$(VERSION)
3+
4+
.PHONY: image
5+
6+
image:
7+
docker buildx build --platform linux/amd64,linux/arm64 --push -t $(IMG) .

0 commit comments

Comments
 (0)