Fix when a base image leaves non-root user

pull/5986/head
Andras Fekete 2023-01-16 13:32:10 -05:00
parent 5311a8e673
commit e90ba67a4c
1 changed files with 3 additions and 1 deletions

View File

@ -1,11 +1,13 @@
ARG DOCKER_BASE_IMAGE=ubuntu:22.04
FROM $DOCKER_BASE_IMAGE
USER root
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y build-essential autoconf libtool git gdb iputils-ping
ARG USER=docker
ARG UID=1000
ARG GID=1000
RUN groupadd -f -g ${GID} docker && useradd -ms /bin/bash ${USER} -u ${UID} -g ${GID}
RUN groupadd -f -g ${GID} docker && ( getent passwd ${UID} || useradd -ms /bin/bash ${USER} -u ${UID} -g ${GID} )
USER ${UID}:${GID}