Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Commit 844eb35

Browse files
committed
add docker buildx support
1 parent 9b6aabe commit 844eb35

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ build:
5555
release:
5656
bash hack/make-rules/release-images.sh
5757

58+
buildx-release:
59+
docker buildx build --no-cache --push --platform linux/arm64,linux/amd64 -f hack/Dockerfile . -t ${IMG}
60+
5861
clean:
5962
-rm -Rf bin
6063
-rm -Rf _output

hack/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM --platform=${BUILDPLATFORM} golang:1.18 as builder
2+
ADD . /build
3+
ARG TARGETOS TARGETARCH
4+
WORKDIR /build/
5+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build
6+
7+
FROM --platform=${TARGETPLATFORM} alpine:3.17
8+
ARG TARGETOS TARGETARCH
9+
WORKDIR /
10+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
11+
apk add ca-certificates bash libc6-compat iptables ip6tables && update-ca-certificates && rm /var/cache/apk/*
12+
COPY --from=builder /build/_output/bin/${TARGETOS}/${TARGETARCH}/yurt-device-controller /yurt-device-controller
13+
ENTRYPOINT ["/yurt-device-controller"]

0 commit comments

Comments
 (0)