FROM golang:1.20 MAINTAINER MichaƂ Czeraszkiewicz # Set the reset cache variable # Read more here: http://czerasz.com/2014/11/13/docker-tip-and-tricks/#use-refreshedat-variable-for-better-cache-control ENV REFRESHED_AT 2019-02-06 RUN apt-get update # Setup User to match Host User # Give the nre user superuser permissions ARG USER_ID=1000 ARG GROUP_ID=1000 ARG USER_NAME=mgmt ARG GROUP_NAME=$USER_NAME RUN groupadd --gid $GROUP_ID $GROUP_NAME && \ useradd --create-home --home /home/$USER_NAME --uid ${USER_ID} --gid $GROUP_NAME --groups sudo $USER_NAME && \ echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers # Copy all the files to the working directory COPY . /home/$USER_NAME/mgmt # Change working directory WORKDIR /home/$USER_NAME/mgmt # Install dependencies RUN make deps # Change user USER ${USER_NAME}