From 07444ace8ce756e29a1ed41204659b11291ad583 Mon Sep 17 00:00:00 2001 From: mason Date: Sat, 9 Nov 2019 09:41:49 -0800 Subject: [PATCH] FEAT: added user to build --- Dockerfile | 11 ++++++++--- group | 1 + passwd | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 group create mode 100644 passwd 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