-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile-setup.sh
118 lines (101 loc) · 4.76 KB
/
dockerfile-setup.sh
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
#!/usr/bin/env bash
echo "✅ Start apt get install base packages"
apt-get update \
&& apt-get -y install curl git vim \
&& apt-get -y install zip unzip \
&& apt-get -y install ca-certificates curl wget apt-transport-https lsb-release gnupg \
&& apt-get -y install jq \
&& apt-get satisfy "python3-pip (<= 22.1)" -y
# install jq from https://stedolan.github.io/jq/download/
# Test whoami
whoami
echo "✅ whoami > run as expected"
#
# Github Action runner
#
mkdir -p actions-runner
cd actions-runner || exit
# from https://github.com/actions/runner/releases
GITHUB_RUNNER_VERSION="${ENV_GITHUB_RUNNER_VERSION:-2.311.0}"
GITHUB_RUNNER_VERSION_SHA="${ENV_GITHUB_RUNNER_VERSION_SHA:-29fc8cf2dab4c195bb147384e7e2c94cfd4d4022c793b346a6175435265aa278}"
curl -o actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz -L https://github.com/actions/runner/releases/download/v${GITHUB_RUNNER_VERSION}/actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz
echo "${GITHUB_RUNNER_VERSION_SHA} actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz" | sha256sum -c
tar xzf ./actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz
rm actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz
bash bin/installdependencies.sh
echo "✅ Installed > github action runner"
#
# AWS CLI
#
cd /tmp ||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MxKiWgBReGvTdqZ0SzyYH4PYCJSE732x/Fw9hfnh1dMTXNcrQXzwOmmFNNegG0Ox\n\
au+VnpcR5Kz3smiTrIwZbRudo1ijhCYPQ7t5CMp9kjC6bObvy1hSIg2xNbMAN/Do\n\
ikebAl36uA6Y/Uczjj3GxZW4ZWeFirMidKbtqvUz2y0UFszobjiBSqZZHCreC34B\n\
hw9bFNpuWC/0SrXgohdsc6vK50pDGdV5kM2qo9tMQ/izsAwTh/d/GzZv8H4lV9eO\n\
tEis+EpR497PaxKKh9tJf0N6Q1YLRHof5xePZtOIlS3gfvsH5hXA3HJ9yIxb8T0H\n\
QYmVr3aIUes20i6meI3fuV36VFupwfrTKaL7VXnsrK2fq5cRvyJLNzXucg0WAjPF\n\
RrAGLzY7nP1xeg1a0aeP+pdsqjqlPJom8OCWc1+6DWbg0jsC74WoesAqgBItODMB\n\
rsal1y/q+bPzpsnWjzHV8+1/EtZmSc8ZUGSJOPkfC7hObnfkl18h+1QtKTjZme4d\n\
H17gsBJr+opwJw/Zio2LMjQBOqlm3K1A4zFTh7wBC7He6KPQea1p2XAMgtvATtNe\n\
YLZATHZKTJyiqA==\n\
=vYOk\n\
-----END PGP PUBLIC KEY BLOCK-----"
gpg --import awscli-pgp
curl -o awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
curl -o awscliv2.sig "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip.sig"
gpg --verify awscliv2.sig awscliv2.zip
unzip -q awscliv2.zip && ./aws/install
rm -fr "aws*"
## Test awscli
aws --version || exit
echo "✅ Installed > awscli"
#
# KUBERNETES DEPENDENCIES
#
# install kubectl from https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | tee /etc/apt/sources.list.d/kubernetes.list
# install helm from https://helm.sh/docs/intro/install/#from-apt-debianubuntu
curl https://baltocdn.com/helm/signing.asc | apt-key add -
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list
apt-get update
echo "✅ Configure kubernetes & Helm for installation"
apt-get satisfy -y "kubectl"
## Test kubectl
kubectl version --client --output json || exit
echo "✅ Installed kubernetes"
apt-get satisfy "helm" -y
## Test helm
helm --help
echo "✅ Installed kubernetes"
# install yq from https://github.com/mikefarah/yq#install
YQ_VERSION="${ENV_YQ_VERSION:-v4.30.6}"
YQ_BINARY="yq_linux_amd64"
wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}.tar.gz -O - | tar xz && mv ${YQ_BINARY} /usr/bin/yq
echo "✅ Installed YQ"
## Test YQ
yq --version
#
# USER CONFIGURATIONS
#
useradd github
mkdir -p /home/github
chown -R github:github /home/github
chown -R github:github /actions-runner