Skip to content

Commit

Permalink
Use non-root user in Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Yash Ajgaonkar <[email protected]>
  • Loading branch information
yash2189 committed Apr 25, 2024
1 parent 015baa7 commit a5f8d06
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,19 @@ RUN go mod download &&\

FROM ${PLATFORM}/alpine:3.15

# tc - is needed for traffic control and shaping on the sidecar. it is part of the iproute2
# Creating a non-root user
RUN adduser -D myuser

# tc - is needed for traffic control and shaping on the sidecar. it is part of the iproute2
# Install necessary packages
RUN apk add --no-cache ca-certificates \
iproute2

# Copy our static executable.
# Switching to the non-root user
USER myuser

COPY --from=gobuilder bin/kubeslice-gw-sidecar .
# Copy our static executable.
COPY --from=gobuilder --chown=myuser:myuser bin/kubeslice-gw-sidecar .

EXPOSE 5000

Expand Down

0 comments on commit a5f8d06

Please sign in to comment.