-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
93 lines (82 loc) · 2.77 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
FROM ubuntu:24.04
LABEL name=netdevops
LABEL maintainer="[email protected]"
RUN apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
apt-transport-https \
build-essential \
curl \
dnsutils \
git \
iproute2 \
iputils-ping \
jq \
lsb-release \
nano \
net-tools \
nmap \
python3 \
python3-dev \
python3-venv \
software-properties-common \
sqlite3 \
tcpdump \
tmux \
traceroute \
unzip \
vim \
wget
# Powershell Core & Az Modules
RUN \
wget -q https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update && \
add-apt-repository universe && \
apt-get install -y powershell && \
pwsh -Command Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted && \
pwsh -Command "Set-Variable -Name 'ProgressPreference' -Value 'SilentlyContinue' && Install-Module -Name Az -AllowClobber" && \
rm packages-microsoft-prod.deb
# Terraform
RUN \
TF_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M ".current_version") && \
wget -nv -O terraform.zip https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip && \
unzip terraform.zip && \
mv terraform /usr/local/bin && \
rm terraform.zip
# Pulumi
RUN \
curl -fsSL https://get.pulumi.com | sh && \
echo "export PATH=$PATH:/root/.pulumi/bin" >> /root/.bashrc
# AWS CLI
RUN \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip -q awscliv2.zip && \
./aws/install && \
rm aws* -rf
# Azure CLI
RUN \
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null && \
AZ_REPO=$(lsb_release -cs) && \
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | tee /etc/apt/sources.list.d/azure-cli.list
RUN apt-get update && apt-get -y install \
azure-cli
# Clean UP
RUN \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
COPY root/* /root/
# Create Python VENV and activate it
RUN \
python3 -m venv /root/venv && \
. /root/venv/bin/activate && \
pip3 install --no-cache-dir -r /root/requirements-buildenv.txt && \
pip3 install --no-cache-dir -r /root/requirements.txt && \
pip3 install --no-cache-dir -r /root/venv/lib/python3.12/site-packages/ansible_collections/azure/azcollection/requirements.txt
# pip3 install --no-cache-dir -r /root/requirements2.txt
# Adjust .bashrc
RUN \
echo "source /root/venv/bin/activate" >> /root/.bashrc && \
echo "export PYTHONIOENCODING=utf-8" >> /root/.bashrc
# Install Ansible Collections
RUN \
. /root/venv/bin/activate && \
ansible-galaxy collection install -r /root/requirements.yml