Skip to content

Commit

Permalink
Use a numeric User ID in the Alpine-based examples
Browse files Browse the repository at this point in the history
This fixes failure of the container to start when run on a system with a
PodSecurityPolicy specifying RunAsUser as "MustRunAsNonRoot".

Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
  • Loading branch information
Paul "Hampy" Hampson committed Jan 30, 2020
1 parent 0d9926e commit 1c2a58f
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/allocator-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o service .
# Create the final image that will run the allocator service
FROM alpine:3.8
RUN apk add --update ca-certificates
RUN adduser -D service
RUN adduser -D -u 1000 service

COPY --from=builder /go/src/agones.dev/agones/examples/allocator-service \
/home/service

RUN chown -R service /home/service && \
chmod o+x /home/service/service

USER service
USER 1000
ENTRYPOINT /home/service/service
4 changes: 2 additions & 2 deletions examples/autoscaler-webhook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server .

# Create the final image that will run the webhook server for FleetAutoscaler webhook policy
FROM alpine:3.8
RUN adduser -D server
RUN adduser -D -u 1000 server

COPY --from=builder /go/src/autoscaler-webhook \
/home/server

RUN chown -R server /home/server && \
chmod o+x /home/server/server

USER server
USER 1000
ENTRYPOINT /home/server/server
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ REPOSITORY = gcr.io/agones-images

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
autoscaler_webhook_tag = $(REPOSITORY)/autoscaler-webhook:0.2
autoscaler_webhook_tag = $(REPOSITORY)/autoscaler-webhook:0.3
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand Down
4 changes: 2 additions & 2 deletions examples/crd-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o client .

# Create the final image that will run the webhook server for FleetAutoscaler webhook policy
FROM alpine:3.8
RUN adduser -D client
RUN adduser -D -u 1000 client

COPY --from=builder /go/src/crd-client \
/home/client

RUN chown -R client /home/client && \
chmod o+x /home/client/client

USER client
USER 1000
ENTRYPOINT /home/client/client
2 changes: 1 addition & 1 deletion examples/crd-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

REPOSITORY ?= gcr.io/agones-images

server_tag = $(REPOSITORY)/crd-client:0.1
server_tag = $(REPOSITORY)/crd-client:0.2

# _____ _
# |_ _|_ _ _ __ __ _ ___| |_ ___
Expand Down
4 changes: 2 additions & 2 deletions examples/simple-tcp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server .
# final image
FROM alpine:3.10

RUN adduser -D server
RUN adduser -D -u 1000 server
COPY --from=builder /go/src/simple-tcp/server /home/server/server
RUN chown -R server /home/server && \
chmod o+x /home/server/server

USER server
USER 1000
ENTRYPOINT ["/home/server/server"]
2 changes: 1 addition & 1 deletion examples/simple-tcp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ REPOSITORY = gcr.io/agones-images

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
server_tag = $(REPOSITORY)/tcp-server:0.3
server_tag = $(REPOSITORY)/tcp-server:0.4
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand Down
4 changes: 2 additions & 2 deletions examples/simple-udp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server .
# final image
FROM alpine:3.10

RUN adduser -D server
RUN adduser -D -u 1000 server
COPY --from=builder /go/src/simple-udp/server /home/server/server
RUN chown -R server /home/server && \
chmod o+x /home/server/server

USER server
USER 1000
ENTRYPOINT ["/home/server/server"]
2 changes: 1 addition & 1 deletion examples/simple-udp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ REPOSITORY = gcr.io/agones-images

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
server_tag = $(REPOSITORY)/udp-server:0.17
server_tag = $(REPOSITORY)/udp-server:0.18
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand Down

0 comments on commit 1c2a58f

Please sign in to comment.