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 23, 2020
1 parent 93c5563 commit 7fbaf13
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 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
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
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"]
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"]

0 comments on commit 7fbaf13

Please sign in to comment.