mirror of https://github.com/scribd/objinsync
setup none-root user in final image stage
This commit is contained in:
parent
05684bb5dc
commit
58eb4d49d2
|
@ -0,0 +1,3 @@
|
|||
dist
|
||||
Dockerfile
|
||||
*.md
|
|
@ -1,13 +1,13 @@
|
|||
FROM golang:1.13.1 as build
|
||||
RUN groupadd -g 1000 1000 && \
|
||||
useradd -r -u 1000 -g 1000 1000
|
||||
ADD . /app
|
||||
RUN chown 1000 app
|
||||
WORKDIR /app
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-extldflags "-static"'
|
||||
|
||||
FROM alpine:3.10.1
|
||||
|
||||
RUN addgroup --gid 1000 app && \
|
||||
adduser --system --uid 1000 --ingroup app app
|
||||
USER app
|
||||
|
||||
COPY --from=build /app/objinsync /bin/objinsync
|
||||
USER 1000
|
||||
|
|
Loading…
Reference in New Issue