forked from markosamuli/ansible-linuxbrew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (35 loc) · 1.25 KB
/
Dockerfile
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:focal
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Use a maintained UK-based mirror with HTTPS support
ARG ubuntu_archive=https://mirror.pulsant.com/sites/ubuntu-archive/
RUN sed -i "s~http://archive.ubuntu.com/ubuntu/~${ubuntu_archive}~g" /etc/apt/sources.list
RUN apt-get update && apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
zsh \
sudo \
python3-minimal \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
ARG user=test
ARG repository=markosamuli.linuxbrew
# Create test user
RUN useradd -m ${user} -s /bin/bash \
&& echo "${user}:${user}" | chpasswd \
&& adduser ${user} sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN touch /home/${user}/.zshrc \
&& chown -R ${user}:${user} /home/${user}
# Create directory for code
RUN mkdir -p /home/${user}/${repository} ; \
chown -R ${user}:${user} /home/${user}/${repository}
VOLUME ["/home/${user}/${repository}"]
# Make sure we have the latest packages
RUN apt-get update
USER test
ARG ansible_version=">=2.9.22"
ENV ANSIBLE_VERSION="${ansible_version}"
RUN python3 -m pip install ansible${ANSIBLE_VERSION}
CMD exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"