Complete reimplementation to support cross platform usage without namespaces
This commit is contained in:
64
container/Containerfile
Normal file
64
container/Containerfile
Normal file
@@ -0,0 +1,64 @@
|
||||
ARG BASE_IMAGE
|
||||
ARG BASE_IMAGE_VERSION
|
||||
|
||||
FROM ${BASE_IMAGE}:${BASE_IMAGE_VERSION}
|
||||
|
||||
ARG BUILD_COMMIT
|
||||
|
||||
LABEL local.build.commit=${BUILD_COMMIT}
|
||||
|
||||
ADD static-repos/google-cloud-sdk.repo /etc/yum.repos.d/google-cloud-sdk.repo
|
||||
ADD static-repos/kubernetes.repo /etc/yum.repos.d/kubernetes.repo
|
||||
ADD https://rpm.releases.hashicorp.com/fedora/hashicorp.repo /etc/yum.repos.d/hashicorp.repo
|
||||
ADD https://cli.github.com/packages/rpm/gh-cli.repo /etc/yum.repos.d/github-cli.repo
|
||||
ADD https://download.docker.com/linux/fedora/docker-ce.repo /etc/yum.repos.d/docker-ce.repo
|
||||
|
||||
RUN dnf install --assumeyes \
|
||||
bind-utils \
|
||||
direnv \
|
||||
docker-ce-cli \
|
||||
docker-buildx-plugin \
|
||||
docker-compose-plugin \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
gh \
|
||||
golang \
|
||||
google-cloud-cli \
|
||||
google-cloud-sdk-gke-gcloud-auth-plugin \
|
||||
jq \
|
||||
kubectl \
|
||||
libacl-devel \
|
||||
libffi-devel \
|
||||
libpq-devel \
|
||||
libvirt-daemon-driver-qemu \
|
||||
libzstd-devel \
|
||||
lz4-devel \
|
||||
make \
|
||||
net-tools \
|
||||
oathtool \
|
||||
openssl-devel \
|
||||
packer \
|
||||
pinentry \
|
||||
podman-remote \
|
||||
postgresql \
|
||||
powerline \
|
||||
python3-devel \
|
||||
python3.10 \
|
||||
python3.10-devel \
|
||||
python3.11 \
|
||||
python3.11-devel \
|
||||
python3.12 \
|
||||
python3.12-devel \
|
||||
python3.13 \
|
||||
python3.9 \
|
||||
ShellCheck \
|
||||
virsh \
|
||||
virt-install \
|
||||
xxhash-devel
|
||||
|
||||
ADD github-install.bash /tmp/github-install.bash
|
||||
RUN bash /tmp/github-install.bash && rm -rf /tmp/github-install.bash
|
||||
|
||||
ADD profile.d/*.sh /etc/profile.d/
|
||||
|
||||
RUN ln -s /usr/bin/podman-remote /usr/bin/podman
|
||||
75
container/github-install.bash
Executable file
75
container/github-install.bash
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
function get_latest() {
|
||||
local repo="${1}"
|
||||
echo $(curl -sSL "https://api.github.com/repos/${repo}/releases/latest" | jq -r '.tag_name')
|
||||
}
|
||||
|
||||
function do_install() {
|
||||
local name
|
||||
name="${1}"
|
||||
|
||||
local url
|
||||
url="${2}"
|
||||
|
||||
local working
|
||||
working=$(mktemp -d)
|
||||
|
||||
local current
|
||||
current=$(pwd)
|
||||
|
||||
echo "Downloading ${name} from ${url}"
|
||||
|
||||
if [[ "${url}" == *.tar.gz ]]; then
|
||||
curl --fail-with-body -sSLo "${working}/${name}.tar.gz" "${url}"
|
||||
cd "${working}"
|
||||
tar -xf "${name}.tar.gz"
|
||||
elif [[ "${url}" == *.zip ]]; then
|
||||
curl --fail-with-body -sSLo "${working}/${name}.zip" "${url}"
|
||||
cd "${working}"
|
||||
unzip "${name}.zip"
|
||||
elif [[ "${url}" == *.rpm ]]; then
|
||||
curl --fail-with-body -sSLo "${working}/${name}.rpm" "${url}"
|
||||
else
|
||||
curl --fail-with-body -sSLo "${working}/${name}" "${url}"
|
||||
fi
|
||||
|
||||
if [[ "${url}" == *.rpm ]]; then
|
||||
dnf install --assumeyes "${working}/${name}.rpm"
|
||||
else
|
||||
mv "${working}/${name}" "/usr/local/bin/${name}"
|
||||
chmod +x "/usr/local/bin/${name}"
|
||||
fi
|
||||
|
||||
cd "${current}"
|
||||
rm -rf "${working}"
|
||||
}
|
||||
|
||||
doctl=$(get_latest digitalocean/doctl)
|
||||
do_install "doctl" "https://github.com/digitalocean/doctl/releases/download/${doctl}/doctl-${doctl:1}-linux-amd64.tar.gz"
|
||||
|
||||
tflint=$(get_latest terraform-linters/tflint)
|
||||
do_install "tflint" "https://github.com/terraform-linters/tflint/releases/download/${tflint}/tflint_linux_amd64.zip"
|
||||
|
||||
butane=$(get_latest coreos/butane)
|
||||
do_install "butane" "https://github.com/coreos/butane/releases/download/${butane}/butane-x86_64-unknown-linux-gnu"
|
||||
|
||||
act=$(get_latest nektos/act)
|
||||
do_install "act" "https://github.com/nektos/act/releases/download/${act}/act_Linux_x86_64.tar.gz"
|
||||
|
||||
hadolint=$(get_latest hadolint/hadolint)
|
||||
do_install "hadolint" "https://github.com/hadolint/hadolint/releases/download/${hadolint}/hadolint-Linux-x86_64"
|
||||
|
||||
tenv=$(get_latest tofuutils/tenv)
|
||||
do_install "tenv" "https://github.com/tofuutils/tenv/releases/download/${tenv}/tenv_${tenv}_amd64.rpm"
|
||||
|
||||
sops=$(get_latest getsops/sops)
|
||||
do_install "sops" "https://github.com/getsops/sops/releases/download/${sops}/sops-${sops:1}-1.x86_64.rpm"
|
||||
|
||||
cosign=$(get_latest sigstore/cosign)
|
||||
do_install cosign "https://github.com/sigstore/cosign/releases/download/${cosign}/cosign-${cosign:1}-1.x86_64.rpm"
|
||||
|
||||
codium=$(get_latest VSCodium/vscodium)
|
||||
do_install codium "https://github.com/VSCodium/vscodium/releases/download/${codium}/codium-${codium}-el8.x86_64.rpm"
|
||||
13
container/profile.d/99-aliases.sh
Normal file
13
container/profile.d/99-aliases.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
alias dnf='echo "WARNING: Package installs should require a toolbox rebuild, use dnf-local to override"'
|
||||
alias dnf-local='command dnf'
|
||||
|
||||
alias prun="poetry run"
|
||||
alias psync="poetry install --sync"
|
||||
alias code='codium'
|
||||
alias ssh='ssh -F ~/.ssh/config'
|
||||
|
||||
alias bk='cd -'
|
||||
alias fuck='sudo $(history -p \!\!)'
|
||||
alias cls='clear'
|
||||
17
container/profile.d/99-load-user-bashrc.sh
Normal file
17
container/profile.d/99-load-user-bashrc.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# If we are running in a toolbox container that uses an alt home dir, then we
|
||||
# won't be automatically loading the global user bashrc, which is annoying becasue
|
||||
# I worked hard to make that bashrc very useful to me. So the below conditional
|
||||
# checks whether the user bashrc exists (because we can't load it if it isn't there)
|
||||
# and that the current home dir does not match the user home dir (because if it does
|
||||
# then we will have already loaded the bashrc when the shell spawned and we'll get
|
||||
# stuck in a loop)
|
||||
|
||||
if [ -f /var/home/"${USER}"/.bashrc ] && [ "${HOME}" != "/var/home/${USER}" ]; then
|
||||
source /var/home/"${USER}"/.bashrc;
|
||||
fi
|
||||
|
||||
if [ -f "${HOME}"/.bashrc ]; then
|
||||
source "${HOME}/.bashrc";
|
||||
fi
|
||||
2
container/static-repos/README.md
Normal file
2
container/static-repos/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
These repository files have no canonical home online so need to be statically
|
||||
saved and directly added to the container.
|
||||
7
container/static-repos/google-cloud-sdk.repo
Normal file
7
container/static-repos/google-cloud-sdk.repo
Normal file
@@ -0,0 +1,7 @@
|
||||
[google-cloud-cli]
|
||||
name=Google Cloud CLI
|
||||
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
repo_gpgcheck=0
|
||||
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
|
||||
6
container/static-repos/kubernetes.repo
Normal file
6
container/static-repos/kubernetes.repo
Normal file
@@ -0,0 +1,6 @@
|
||||
[kubernetes]
|
||||
name=Kubernetes
|
||||
baseurl=https://pkgs.k8s.io/core:/stable:/v1.32/rpm/
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.32/rpm/repodata/repomd.xml.key
|
||||
Reference in New Issue
Block a user