Skip to content

Instantly share code, notes, and snippets.

@aprxi
Last active March 25, 2021 06:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save aprxi/dda469ac987812d17790fa3ca5e8ec14 to your computer and use it in GitHub Desktop.
Save aprxi/dda469ac987812d17790fa3ca5e8ec14 to your computer and use it in GitHub Desktop.
Dockerfile_20190214
FROM alpine as base
RUN apk update \
&& apk add --no-cache \
bash
FROM scratch as user
COPY --from=base . .
ARG HOST_UID=${HOST_UID:-4000}
ARG HOST_USER=${HOST_USER:-nodummy}
RUN [ "${HOST_USER}" == "root" ] || \
(adduser -h /home/${HOST_USER} -D -u ${HOST_UID} ${HOST_USER} \
&& chown -R "${HOST_UID}:${HOST_UID}" /home/${HOST_USER})
USER ${HOST_USER}
WORKDIR /home/${HOST_USER}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment