Skip to content

Commit 0538953

Browse files
TUN-6652: Publish dockerfile for both amd64 and arm64
This change seeks to push an arm64 built image to dockerhub for arm users to run. This should spin cloudflared on arm machines without the warning WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
1 parent 8823535 commit 0538953

File tree

4 files changed

+60
-3
lines changed

4 files changed

+60
-3
lines changed

.docker-images

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
images:
22
- name: cloudflared
3-
dockerfile: Dockerfile
3+
dockerfile: Dockerfile.$ARCH
44
context: .
55
versions:
66
- latest
77
registries:
88
- name: docker.io/cloudflare
99
user: env:DOCKER_USER
1010
password: env:DOCKER_PASSWORD
11+
architectures:
12+
- amd64
13+
- arm64

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# use a builder image for building cloudflare
22
ARG TARGET_GOOS
33
ARG TARGET_GOARCH
4-
FROM golang:1.18.1 as builder
4+
FROM golang:1.19 as builder
55
ENV GO111MODULE=on \
66
CGO_ENABLED=0 \
77
TARGET_GOOS=${TARGET_GOOS} \
@@ -18,7 +18,7 @@ COPY . .
1818
RUN make cloudflared
1919

2020
# use a distroless base image with glibc
21-
FROM gcr.io/distroless/base-debian10:nonroot
21+
FROM gcr.io/distroless/base-debian11:nonroot
2222

2323
# copy our compiled binary
2424
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/

Dockerfile.amd64

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# use a builder image for building cloudflare
2+
FROM golang:1.19 as builder
3+
ENV GO111MODULE=on \
4+
CGO_ENABLED=0
5+
6+
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
7+
8+
WORKDIR /go/src/github.com/cloudflare/cloudflared/
9+
10+
# copy our sources into the builder image
11+
COPY . .
12+
13+
# compile cloudflared
14+
RUN GOOS=linux GOARCH=amd64 make cloudflared
15+
16+
# use a distroless base image with glibc
17+
FROM gcr.io/distroless/base-debian11:nonroot
18+
19+
# copy our compiled binary
20+
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
21+
22+
# run as non-privileged user
23+
USER nonroot
24+
25+
# command / entrypoint of container
26+
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
27+
CMD ["version"]

Dockerfile.arm64

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# use a builder image for building cloudflare
2+
FROM golang:1.19 as builder
3+
ENV GO111MODULE=on \
4+
CGO_ENABLED=0
5+
6+
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
7+
8+
WORKDIR /go/src/github.com/cloudflare/cloudflared/
9+
10+
# copy our sources into the builder image
11+
COPY . .
12+
13+
# compile cloudflared
14+
RUN GOOS=linux GOARCH=arm64 make cloudflared
15+
16+
# use a distroless base image with glibc
17+
FROM gcr.io/distroless/base-debian11:nonroot
18+
19+
# copy our compiled binary
20+
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
21+
22+
# run as non-privileged user
23+
USER nonroot
24+
25+
# command / entrypoint of container
26+
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
27+
CMD ["version"]

0 commit comments

Comments
 (0)