From 3fa71157a389ca6e038a345da43ac8f5f747dccb Mon Sep 17 00:00:00 2001 From: Jackson Delahunt Date: Thu, 10 Jan 2019 13:03:04 +0000 Subject: [PATCH] fixes --- Dockerfile | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5bb52f4..f0f0878 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,20 @@ FROM stemn/development-environment:latest USER root -ENV HOME /home/jackson +ENV BASE_USER stemn ENV USER jackson +ENV HOME /$USER/home ENV SSH_AUTH_SOCK=/ssh-auth.sock ENV STEMN_GIT_EMAIL="jackson@stemn.com" ENV STEMN_GIT_NAME="Jackson Delahunt" -WORKDIR $HOME +# Keep the existing home directory +RUN mkdir /$USER && \ + mv /$BASE_USER/home $HOME # Name the first non-root user jackson -RUN sed -i "s/stemn/$USER/g" /etc/passwd - -# Enable password-less sudo for jackson -RUN echo 'jackson ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers +RUN sed -i "s/$BASE_USER/$USER/g" /etc/passwd +RUN sed -i "s/$BASE_USER/$USER/g" /etc/group # Install chrome RUN apt update && apt install --yes \ @@ -36,30 +37,41 @@ RUN apt update && apt install --yes \ google-chrome-stable \ --no-install-recommends && \ apt purge --auto-remove -y curl && \ - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/* && \ + rm /etc/apt/sources.list.d/google.list -# Add jackson to groups required to run chrome +# Add user to groups required to run chrome RUN groupadd --system chrome && \ usermod --groups audio,chrome,video $USER # Install vs code -RUN wget -O code.deb -nv https://go.microsoft.com/fwlink/?LinkID=760868 && \ - apt install code.deb && \ +RUN echo 'deb http://au.archive.ubuntu.com/ubuntu/ bionic main restricted universe' > /etc/apt/sources.list && \ + apt update && \ + wget -O code.deb -nv https://go.microsoft.com/fwlink/?LinkID=760868 && \ + apt install --yes ./code.deb && \ rm code.deb -# Clone dotfiles configuration -RUN git clone git@github.com:sabrehagen/dotfiles-alacritty.git -RUN git clone git@github.com:sabrehagen/dotfiles-git.git -RUN git clone git@github.com:sabrehagen/dotfiles-scripts.git -RUN git clone git@github.com:sabrehagen/dotfiles-tmux.git -RUN git clone git@github.com:sabrehagen/dotfiles-vcsh.git -RUN git clone git@github.com:sabrehagen/dotfiles-zsh.git +# Remove mock sudo +RUN rm /usr/local/bin/sudo # Install operating system utilities RUN apt install --yes \ + sudo \ vcsh \ wicd-curses +# Enable password-less sudo for user +RUN echo "$USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers + +# Clone dotfiles configuration +RUN alias https-to-git="sed 's;https://github.com/\(.*\);git@github.com:\1.git;'" +RUN git clone https://github.com/sabrehagen/dotfiles-alacritty +RUN git clone https://github.com/sabrehagen/dotfiles-git +RUN git clone https://github.com/sabrehagen/dotfiles-scripts +RUN git clone https://github.com/sabrehagen/dotfiles-tmux +RUN git clone https://github.com/sabrehagen/dotfiles-vcsh +RUN git clone https://github.com/sabrehagen/dotfiles-zsh + # Add zsh aliases RUN echo 'tree="tree -a -I .git -I node_modules -L 4"' >> $HOME/.zshenv RUN echo 'wifi=wicd-curses' >> $HOME/.zshenv @@ -68,4 +80,8 @@ RUN echo 'wifi=wicd-curses' >> $HOME/.zshenv RUN echo 'keychain $HOME/.ssh/id_rsa >/dev/null 2>&1' >> $HOME/.zshenv RUN echo 'source $HOME/.keychain/$(hostname)-sh' >> $HOME/.zshenv +# Remove root ownership of all files under non-root user directory +RUN chown -R $USER:$USER $HOME + USER $USER +WORKDIR $HOME