Files
dotfiles/Dockerfile
2020-07-15 21:40:18 +01:00

29 lines
825 B
Docker

from ubuntu:bionic as install
# Install sudo and make, git since built-in is skipped
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get -qqy update \
&& apt-get -qqy install curl git make software-properties-common sudo
# Create user with sudo priviledge
ARG USER="test-user"
RUN useradd --create-home -m "$USER" \
&& adduser "$USER" sudo
RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" \
>>/etc/sudoers
# Filesystem steps
RUN rm /home/$USER/.profile /home/$USER/.bashrc
ENV WORKSPACE="/home/$USER/workspace"
ADD --chown=test-user . "$WORKSPACE/dotfiles"
WORKDIR "$WORKSPACE/dotfiles"
# Install steps
USER test-user
ARG TARGET="all"
ENV LOG_TARGET="STDOUT"
RUN make install TARGET=$TARGET
# Test entrypoint
ENTRYPOINT [ "make", "--directory", "tests", "TARGET=$TARGET" ]