Skip to content

Commit e10478f

Browse files
committed
build: run container securely as a non-root user
- Add a non-root user for running the container - Set the container to run as the new user instead of root Signed-off-by: appleboy <[email protected]>
1 parent 8c3eace commit e10478f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docker/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ LABEL org.opencontainers.image.description="A CLI written in Go language that wr
1313
LABEL org.opencontainers.image.licenses=MIT
1414

1515
RUN apk add --no-cache ca-certificates git && \
16-
rm -rf /var/cache/apk/*
16+
rm -rf /var/cache/apk/* && \
17+
adduser -D -H -u 1000 codegpt
1718

1819
COPY release/${TARGETOS}/${TARGETARCH}/codegpt /bin/
1920

21+
USER codegpt
22+
2023
CMD ["/bin/codegpt"]

0 commit comments

Comments
 (0)