-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.alpine
39 lines (35 loc) · 1.33 KB
/
Dockerfile.alpine
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
FROM alpine: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=1000
ARG USER_GID=$USER_UID
ARG HOME=/home/$USERNAME
ARG INSTALL_TYPE=mini
# Install required packages
RUN apk -q --no-progress --no-cache add sudo bash && \
# Create user
addgroup --gid $USER_GID $USERNAME && \
# Set Zsh as the default shell
adduser --system $USERNAME --shell /bin/zsh --uid $USER_UID && \
mkdir -p /etc/sudoers.d && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME && \
# Set default user for WSL and Network settings
echo -e "[user]\ndefault=$USERNAME\n[interop]\nappendWindowsPath=false" >> /etc/wsl.conf && \
# ISSUE: WSL interoperability with Apline. /etc/profile overwrites the PATH variable in .zshenv
sed -i "s/^export PATH/#export PATH/" /etc/profile
# 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