forked from growlf/toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
95 lines (80 loc) · 3.33 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
FROM python:3.12-slim-bullseye
# Passed from Github Actions
ARG GIT_VERSION_TAG=unspecified
ARG GIT_COMMIT_MESSAGE=unspecified
ARG GIT_VERSION_HASH=unspecified
# Install updates and docker
RUN apt-get -yq update && apt-get -yq install \
curl \
gnupg \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& echo "deb https://download.docker.com/linux/debian bullseye stable" | tee /etc/apt/sources.list.d/docker.list \
&& apt-get -yq update \
&& apt-get -yq install --no-install-recommends \
docker-ce-cli docker-compose-plugin
# Install apps/tools
RUN apt-get -yq install --no-install-recommends \
sudo openssh-client mosquitto-clients \
nano vim less \
zsh git rsync bzip2 \
tcpdump traceroute iproute2 dnsutils whois mtr iftop iputils-ping wget nmap netcat-traditional \
procps \
htop \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# ensure that there is a place to mount the host files
RUN mkdir /host
# Set tthe working directory for installations and login
WORKDIR /app
# Copy in any/all additional files from our project
ADD src/requirements.txt .
# Istall Python basic libraries
RUN python3 -m pip install --no-cache-dir -r requirements.txt
# Setup a user to match the host and reduce the frustration/confusion of file ownership
ARG USERNAME=ubuntu
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME && groupadd --gid 999 docker \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
RUN usermod -aG docker $USERNAME
# You can read these files for the information in your application
RUN echo $GIT_VERSION_TAG > GIT_VERSION_TAG.txt
RUN echo $GIT_COMMIT_MESSAGE > GIT_COMMIT_MESSAGE.txt
RUN echo $GIT_VERSION_HASH > GIT_VERSION_HASH.txt
# Switch to the user now so that file ownership matches
USER $USERNAME
# Install ZSH, OhMyZSH, themes and plugins
ADD --chown=1000:1000 --chmod=+x src/zsh-in-docker.sh .
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
RUN ./zsh-in-docker.sh \
-p git \
-p https://github.com/zsh-users/zsh-autosuggestions \
-p https://github.com/zsh-users/zsh-completions \
-p https://github.com/zsh-users/zsh-history-substring-search \
-p https://github.com/zsh-users/zsh-syntax-highlighting \
-p 'history-substring-search' \
-p docker \
-p colorize \
-p invoke \
-p aws \
-p sudo \
-p tig \
-p dirhistory \
-p history \
-a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \
-a 'bindkey "\$terminfo[kcud1]" history-substring-search-down' \
-a '[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh'
# -p fzf-zsh-plugin \
ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh
ADD --chown=1000:1000 src/.zshrc /home/$USERNAME/.zshrc
ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh
ADD --chown=1000:1000 --chmod=+x src/tasks.py .
ADD --chown=1000:1000 --chmod=+x https://private-sw-downloads.s3.amazonaws.com/archfx_broker/preflight/broker_preflight.sh .
ADD --chown=1000:1000 --chmod=+x src/test_net.sh .
ADD --chown=1000:1000 src/nodes.list .
# Set default command
CMD ["/bin/zsh"]