-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
158 lines (139 loc) · 4.09 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
FROM ubuntu:18.04
LABEL Maintainer = "Nicolas MICHEL <nicolas@vpackets.net>"
# Variable Definition
ENV ANSIBLE_VERSION "4.1.0"
ENV DEBIAN_FRONTEND=noninteractive
ENV PACKER_VERSION "1.7.3"
ENV TERRAFORM_VERSION "1.0.1"
ENV POWERSHELL_VERSION "7.1.3"
# Creating Home Directory
WORKDIR /home/nmichel
RUN mkdir -p /home/nmichel/ansible
RUN mkdir -p /home/nmichel/code
RUN mkdir -p /home/nmichel/lab-images
# Copy requirement file (PIP Libraries)
COPY requirements.txt /home/nmichel/requirements.txt
# Copy Ansible Config
COPY Ansible/ansible.cfg /etc/ansible/ansible.cfg
# Fix bad proxy issue
COPY system/99fixbadproxy /etc/apt/apt.conf.d/99fixbadproxy
# Clear previous sources
RUN rm /var/lib/apt/lists/* -vf
#install and source ansible
RUN apt-get -y update --allow-unauthenticated && \
apt-get -y dist-upgrade && \
apt-get -y --force-yes install \
apt-utils \
build-essential \
ca-certificates \
curl \
dnsutils \
fping \
git \
hping3 \
htop \
httpie \
iftop \
# need to expose Port
iperf \
iperf3 \
iproute2 \
iputils-arping \
iputils-clockdiff \
iputils-ping \
iputils-tracepath \
libfontconfig \
liblttng-ust0 \
man \
mtr \
mysql-client \
mysql-server \
nano \
net-tools \
#net-snmp \
netcat \
netperf \
ngrep \
nload \
nmap \
openssh-client \
openssh-server \
openssl \
packer \
p0f \
python-pip \
python-scapy \
python3-dev \
python3-distutils \
python3-pip \
python3-scapy \
python3.7 \
python3.8 \
rsync \
snmp \
snmp-mibs-downloader \
snmpd \
socat \
software-properties-common \
speedtest-cli \
#sysctl \
openssh-server \
sshpass \
supervisor \
sudo \
tcpdump \
tcptraceroute \
telnet \
traceroute \
tshark \
unzip \
wget \
vim \
wget \
tree \
zsh \
zsh-syntax-highlighting
# Install Powershell
#RUN wget https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell_${POWERSHELL_VERSION}-1.ubuntu.18.04_amd64.deb
#RUN dpkg -i powershell_${POWERSHELL_VERSION}-1.ubuntu.18.04_amd64.deb
#RUN rm powershell_${POWERSHELL_VERSION}-1.ubuntu.18.04_amd64.deb
# Install PowerCLI
#RUN pwsh -Command Install-Module VMware.PowerCLI -Force -Verbose
#RUN pwsh -Command Install-Module -Name VMware.PowerCLI -Scope AllUsers -Force -Verbose
# Install NodeJS
RUN curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
RUN apt-get install -y nodejs
# Install Oh-My-ZSH
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
# Install Packer
RUN wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip
RUN unzip packer_${PACKER_VERSION}_linux_amd64.zip
RUN mv packer /usr/local/bin
# Install Terraform
RUN wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
RUN unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/
# Install Pip requirements
RUN pip3 install -q --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install -q ansible==$ANSIBLE_VERSION
RUN pip3 install -r requirements.txt
#RUN pip3 install pyATS[library]
# Add user nmichel
RUN useradd -ms /bin/zsh nmichel
RUN usermod -a -G sudo,nmichel nmichel
# Copy Oh-My_ZSH Setting
COPY .zshrc /home/nmichel/.zshrc
ADD .oh-my-zsh /home/nmichel/.oh-my-zsh
RUN chown -R nmichel:nmichel /home/nmichel
#RUN git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
#RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
# Install OVF Tools
COPY system/ovftools/VMware-ovftool-4.4.0-16360108-lin.x86_64.bundle /home/nmichel/VMware-ovftool-4.4.0-16360108-lin.x86_64.bundle
RUN /bin/bash /home/nmichel/VMware-ovftool-4.4.0-16360108-lin.x86_64.bundle --eulas-agreed --required --console
# Cleanup
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN rm -rf requirements.txt
RUN rm packer_${PACKER_VERSION}_linux_amd64.zip
RUN rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip
RUN rm VMware-ovftool-4.4.0-16360108-lin.x86_64.bundle