-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.ubuntu
46 lines (41 loc) · 1.53 KB
/
Dockerfile.ubuntu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM ubuntu:latest
ENV LANG=C.UTF-8 \
LANGUAGE=C.UTF-8 \
LC_ALL=C.UTF-8 \
TERM=xterm-256color
# ARG should be after FROM
ARG USERNAME=maurice
ARG USER_UID=1001
ARG USER_GID=$USER_UID
ARG HOME=/home/$USERNAME
ARG INSTALL_TYPE=mini
SHELL ["/bin/bash", "-c"]
# Install man pages in Ubuntu docker image
RUN sed -i 's:^path-exclude=/usr/share/man:#path-exclude=/usr/share/man:' /etc/dpkg/dpkg.cfg.d/excludes && \
# Install required packages
apt-get -qq update >/dev/null 2>&1 && \
apt-get -qq install -y --no-install-recommends \
sudo && \
# Create user
groupadd --gid $USER_GID $USERNAME && \
# Set Zsh as the default shell
useradd --uid $USER_UID --gid $USER_GID -m -N -s /bin/zsh $USERNAME && \
mkdir -p /etc/sudoers.d && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME && \
# Add docker permissions
groupadd docker && \
usermod -aG docker $USERNAME && \
# Set default user for WSL and Network settings
echo -e "[user]\ndefault=$USERNAME\n[interop]\nappendWindowsPath=false" >> /etc/wsl.conf
# Set default user
USER $USERNAME
WORKDIR $HOME
COPY --chown=$USERNAME:$USERNAME install.sh $HOME/install.sh
COPY --chown=$USERNAME:$USERNAME tests /tmp/tests
# Bootstrap
RUN bash install.sh $INSTALL_TYPE && rm install.sh && \
# Run tests
echo -e "\n#########\n# TESTS #\n#########\n" && \
for test in /tmp/tests/*.sh; do bash "$test"; done && \
rm -rf /tmp/tests