new user in docker

pull/24/head
Akhil Gupta 4 years ago
parent 69dddc9f45
commit 0962aa29ba

@ -1,4 +1,8 @@
ARG GO_VERSION=1.15.2 ARG GO_VERSION=1.15.2
ENV UID=998
ENV GID=100
ENV CONFIG=/config
ENV DATA=/assets
FROM golang:${GO_VERSION}-alpine AS builder FROM golang:${GO_VERSION}-alpine AS builder
@ -22,12 +26,17 @@ RUN mkdir -p /api
WORKDIR /api WORKDIR /api
COPY --from=builder /api/app . COPY --from=builder /api/app .
COPY client ./client COPY client ./client
RUN mkdir /config RUN mkdir /config; \
RUN mkdir /assets mkdir /assets
ENV CONFIG=/config
ENV DATA=/assets RUN groupadd -g ${GID} poduser &&\
RUN chmod 777 /assets; \ useradd -l -u ${UID} -g poduser poduser &&\
chmod 777 /config; chown --changes --silent --no-dereference --recursive \
${UID}:${GID} \
/assets \
/config
USER poduser
EXPOSE 8080 EXPOSE 8080
VOLUME ["/config", "/assets"] VOLUME ["/config", "/assets"]

Loading…
Cancel
Save