FEAT: added user to build

This commit is contained in:
mason 2019-11-09 09:41:49 -08:00
parent 1699bc8106
commit 07444ace8c
3 changed files with 10 additions and 3 deletions

View file

@ -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"]
COPY --from=builder /go/src/github.com/PierreZ/goStatic/bin/ .
USER appuser
ENTRYPOINT ["/goStatic"]

1
group Normal file
View file

@ -0,0 +1 @@
appgroup:x:1231:appuser

1
passwd Normal file
View file

@ -0,0 +1 @@
appuser:x:1234:1231::/home/appuser:/bin/false