Skip to content

Commit

Permalink
Add QEMU, buildx and Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Nov 14, 2024
1 parent 475e38e commit c884a3d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,30 @@ USER root
RUN (echo 'DPkg::Post-Invoke {"/bin/rm -f /var/cache/apt/archives/*.deb || true";};' | tee /etc/apt/apt.conf.d/clean) &&\
apt-get update &&\
apt-get upgrade -y &&\
apt-get install -y curl wget make git unzip gnupg software-properties-common jq &&\
## TerraForm
apt-get install -y curl wget make git unzip gnupg software-properties-common jq ca-certificates &&\
## TerraForm: Prep
(wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null) &&\
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint &&\
(echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list) &&\
## Docker + QEMU + buildx: Prep
install -m 0755 -d /etc/apt/keyrings &&\
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc &&\
chmod a+r /etc/apt/keyrings/docker.asc &&\
(echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null) &&\
## TerraForm: Prep
## Docker + QEMU + buildx: Install
apt-get update &&\
apt-get install -y terraform &&\
apt-get install -y terraform docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin qemu-user-static &&\
## AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "/tmp/awscliv2.zip" &&\
unzip /tmp/awscliv2.zip &&\
./aws/install &&\
rm /tmp/* -Rf &&\
## Helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 &&\
chmod 700 get_helm.sh &&\
./get_helm.sh &&\
rm ./get_helm.sh &&\

## See https://github.com/actions/checkout/issues/956
groupmod -g 1000 runner && usermod -u 1000 runner

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ Also includes the following tools:
* TerraForm
* AWS CLI (v2)
* Helm
* Docker + QEMU + BuildX

Unlocks node v20 that is already available in the image
5 changes: 5 additions & 0 deletions test/test_docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pytest

def test_terraform(host):
assert 'Hello from Docker!' in host.run('docker run hello-world').stdout
assert 'This message shows that your installation appears to be working correctly.' in host.run('docker run hello-world').stdout
2 changes: 1 addition & 1 deletion tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare -r DOCKER_TAG="$1"

printf "Starting a container for '%s'\\n" "$DOCKER_TAG"

DOCKER_CONTAINER=$(docker run --rm -v "$(pwd)/test:/tests" -t -d "$DOCKER_TAG")
DOCKER_CONTAINER=$(docker run --rm -v "$(pwd)/test:/tests" -v /var/run/docker.sock:/var/run/docker.sock:ro -t -d "$DOCKER_TAG")
readonly DOCKER_CONTAINER

# Let's register a trap function, if our tests fail, finish or the script gets
Expand Down

0 comments on commit c884a3d

Please sign in to comment.