From 1bd22e6dff05e0090399153150066aa39d37a001 Mon Sep 17 00:00:00 2001 From: PRIHLOP Date: Tue, 8 Mar 2022 21:13:12 +0300 Subject: [PATCH] Change uid and guid to more secure. Change user ID and group ID to nobody user and nogroup. Change username to gostatic. --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b3f6b9d..d0f0aea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,16 +18,16 @@ RUN mkdir ./bin && \ CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build ${BUILD_ARGS} -ldflags="-s" -tags netgo -installsuffix netgo -o ./bin/goStatic && \ mkdir ./bin/etc && \ - ID=$(shuf -i 100-9999 -n 1) && \ + ID=65534 && \ upx -9 ./bin/goStatic && \ echo $ID && \ - echo "appuser:x:$ID:$ID::/sbin/nologin:/bin/false" > ./bin/etc/passwd && \ - echo "appgroup:x:$ID:appuser" > ./bin/etc/group + echo "gostatic:x:$ID:$ID::/sbin/nologin:/bin/false" > ./bin/etc/passwd && \ + echo "gostatic:x:$ID:gostatic" > ./bin/etc/group # stage 1 FROM scratch WORKDIR / COPY --from=builder /go/src/github.com/PierreZ/goStatic/bin/ . -USER appuser +USER gostatic ENTRYPOINT ["/goStatic"]