2018-04-06 12:07:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2018-11-30 14:13:49 +00:00
|
|
|
build_packages=(
|
|
|
|
apt-transport-https
|
|
|
|
lsb-release
|
|
|
|
)
|
2018-04-06 12:07:02 +00:00
|
|
|
|
2018-11-30 14:13:49 +00:00
|
|
|
install_packages=(
|
|
|
|
docker-ce
|
|
|
|
jq
|
|
|
|
make
|
2018-04-06 12:07:02 +00:00
|
|
|
sudo
|
2019-04-01 22:39:54 +00:00
|
|
|
zip
|
2018-11-30 14:13:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
apt-get update
|
2018-04-06 12:07:02 +00:00
|
|
|
|
2018-11-30 14:13:49 +00:00
|
|
|
# Install packages required for building the image
|
|
|
|
apt-get install -y --no-install-recommends ${build_packages[@]}
|
2018-04-06 12:07:02 +00:00
|
|
|
|
2018-11-30 14:13:49 +00:00
|
|
|
# Activate docker repo
|
|
|
|
curl -sSfL https://download.docker.com/linux/debian/gpg | apt-key add -
|
2018-04-06 12:07:02 +00:00
|
|
|
echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -sc) stable" >/etc/apt/sources.list.d/docker.list
|
|
|
|
apt-get update
|
2018-11-30 14:13:49 +00:00
|
|
|
|
|
|
|
# Install packages to stay in the image
|
|
|
|
apt-get install -y --no-install-recommends ${install_packages[@]}
|
2018-04-06 12:07:02 +00:00
|
|
|
|
|
|
|
# Allow jenkins to use `sudo` and docker
|
|
|
|
echo "jenkins ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers.d/jenkins
|
|
|
|
usermod -a -G docker jenkins
|
|
|
|
|
2020-09-07 17:51:21 +00:00
|
|
|
# Install Vault for global usage
|
|
|
|
VAULT_VERSION=$(curl -sSfL "https://lv.luzifer.io/catalog-api/vault/latest.txt?p=version")
|
|
|
|
curl -sSfLo vault.zip "https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip"
|
|
|
|
unzip vault.zip
|
|
|
|
rm vault.zip
|
|
|
|
install -Dm0755 -t /usr/local/bin vault
|
|
|
|
|
2018-04-06 12:07:02 +00:00
|
|
|
# Cleanup
|
2018-11-30 14:13:49 +00:00
|
|
|
apt-get purge -y ${build_packages[@]}
|
2018-04-06 12:07:02 +00:00
|
|
|
apt-get autoremove --purge -y
|
|
|
|
rm -rf /var/lib/apt/lists/*
|