Skip to content
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

Running gtoken as non-root user #37

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
10 changes: 8 additions & 2 deletions cmd/gtoken-webhook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ RUN make
# ------ get latest CA certificates
#
FROM alpine:3.15 as certs
RUN addgroup -S -g 9000 gtoken
RUN adduser -S -u 9000 -g 9000 gtoken
RUN apk --update add ca-certificates


Expand All @@ -43,8 +45,12 @@ FROM scratch

# copy CA certificates
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

# copy /etc.passwd and /etc/group
COPY --from=certs /etc/passwd /etc/passwd
COPY --from=certs /etc/group /etc/group
# this is the last commabd since it's never cached
COPY --from=build /go/src/gtoken-webhook/.bin/github.com/doitintl/gtoken-webhook /gtoken-webhook

ENTRYPOINT ["/gtoken-webhook"]
USER 9000:9000

ENTRYPOINT ["/gtoken-webhook"]
10 changes: 8 additions & 2 deletions cmd/gtoken/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ RUN make
# ------ get latest CA certificates
#
FROM alpine:3.15 as certs
RUN addgroup -S -g 9000 gtoken
RUN adduser -S -g 9000 -u 9000 gtoken
RUN apk --update add ca-certificates
# this is for debug only Alpine image
COPY --from=build /go/src/gtoken/.bin/github.com/doitintl/gtoken /gtoken
Expand All @@ -46,8 +48,12 @@ FROM scratch

# copy CA certificates
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

# copy /etc/passwd and /etc/group
COPY --from=certs /etc/passwd /etc/passwd
COPY --from=certs /etc/group /etc/group
# this is the last commabd since it's never cached
COPY --from=build /go/src/gtoken/.bin/github.com/doitintl/gtoken /gtoken

ENTRYPOINT ["/gtoken"]
USER 9000:9000

ENTRYPOINT ["/gtoken"]