Skip to content

Commit 4b47485

Browse files
committed
Add non-root user
1 parent 8ccda51 commit 4b47485

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

go/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
1313
apt-get clean -y && \
1414
rm -r /var/cache/* /var/lib/apt/lists/*
1515

16+
# Create the user
17+
ARG USERNAME=user
18+
ARG USER_UID=1000
19+
ARG USER_GID=$USER_UID
20+
21+
RUN groupadd --gid $USER_GID $USERNAME && \
22+
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
23+
24+
USER user
25+
1626
ENV GOPATH=/go
1727

1828
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH

0 commit comments

Comments
 (0)