Skip to content

Use numeric user in Dockerfiles #1446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# use a builder image for building cloudflare
ARG TARGET_GOOS
ARG TARGET_GOARCH
FROM golang:1.22.10 as builder
FROM golang:1.22.10 AS builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
TARGET_GOOS=${TARGET_GOOS} \
Expand Down Expand Up @@ -30,7 +30,7 @@ LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/

# run as non-privileged user
USER nonroot
USER 1002

# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# use a builder image for building cloudflare
FROM golang:1.22.10 as builder
FROM golang:1.22.10 AS builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
# the CONTAINER_BUILD envvar is used set github.com/cloudflare/cloudflared/metrics.Runtime=virtual
# which changes how cloudflared binds the metrics server
CONTAINER_BUILD=1
CONTAINER_BUILD=1

WORKDIR /go/src/github.com/cloudflare/cloudflared/

Expand All @@ -25,7 +25,7 @@ LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/

# run as non-privileged user
USER nonroot
USER 1002

# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# use a builder image for building cloudflare
FROM golang:1.22.10 as builder
FROM golang:1.22.10 AS builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
# the CONTAINER_BUILD envvar is used set github.com/cloudflare/cloudflared/metrics.Runtime=virtual
Expand All @@ -25,7 +25,7 @@ LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/

# run as non-privileged user
USER nonroot
USER 1002

# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
Expand Down
2 changes: 1 addition & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.10 as builder
FROM golang:1.22.10 AS builder
ENV GO111MODULE=on \
CGO_ENABLED=0
WORKDIR /go/src/github.com/cloudflare/cloudflared/
Expand Down