diff --git a/Dockerfile b/Dockerfile index 11f4de8..c488369 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,18 @@ FROM golang:latest as builder WORKDIR /go/src/github.com/PierreZ/goStatic COPY . . -RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -tags netgo -installsuffix netgo +RUN mkdir ./bin && \ + CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -tags netgo -installsuffix netgo -o ./bin/goStatic && \ + mkdir ./bin/etc && \ + ID=$(shuf -i 100-9999 -n 1) && \ + echo $ID && \ + echo "appuser:x:$ID:$ID::/sbin/nologin:/bin/false" > ./bin/etc/passwd && \ + echo "appgroup:x:$ID:appuser" > ./bin/etc/group # stage 1 FROM scratch WORKDIR / -COPY --from=builder /go/src/github.com/PierreZ/goStatic/goStatic . -ENTRYPOINT ["/goStatic"] \ No newline at end of file +COPY --from=builder /go/src/github.com/PierreZ/goStatic/bin/ . +USER appuser +ENTRYPOINT ["/goStatic"] + \ No newline at end of file