Merge pull request #22 from solaris765/master
FEAT: added user to build
This commit is contained in:
commit
08d27145aa
1 changed files with 11 additions and 3 deletions
14
Dockerfile
14
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"]
|
||||
COPY --from=builder /go/src/github.com/PierreZ/goStatic/bin/ .
|
||||
USER appuser
|
||||
ENTRYPOINT ["/goStatic"]
|
||||
|
Loading…
Reference in a new issue