diff --git a/Dockerfile b/Dockerfile index 11f4de8..0d35d08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,15 @@ 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 && \ + cp ./passwd ./bin/etc && \ + cp ./group ./bin/etc # 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"] diff --git a/group b/group new file mode 100644 index 0000000..14bf15f --- /dev/null +++ b/group @@ -0,0 +1 @@ +appgroup:x:1231:appuser diff --git a/passwd b/passwd new file mode 100644 index 0000000..403de03 --- /dev/null +++ b/passwd @@ -0,0 +1 @@ +appuser:x:1234:1231::/home/appuser:/bin/false