Merge pull request #42 from halverneus/dev

Don't run as 'root' in Dockerfile
This commit is contained in:
Jeromy Streets 2020-01-25 10:18:06 -08:00 committed by GitHub
commit e30609c0c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,8 @@ COPY . .
RUN go test -cover ./...
RUN CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o /serve /build/bin/serve
RUN adduser --system --no-create-home --uid 1000 --shell /usr/sbin/nologin static
################################################################################
## DEPLOYMENT CONTAINER
################################################################################
@ -23,6 +25,9 @@ FROM scratch
EXPOSE 8080
COPY --from=builder /serve /
COPY --from=builder /etc/passwd /etc/passwd
USER static
ENTRYPOINT ["/serve"]
CMD []