Skip to content

Commit c884a3d

Browse files
committed
Add QEMU, buildx and Docker
1 parent 475e38e commit c884a3d

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,30 @@ USER root
88
RUN (echo 'DPkg::Post-Invoke {"/bin/rm -f /var/cache/apt/archives/*.deb || true";};' | tee /etc/apt/apt.conf.d/clean) &&\
99
apt-get update &&\
1010
apt-get upgrade -y &&\
11-
apt-get install -y curl wget make git unzip gnupg software-properties-common jq &&\
12-
## TerraForm
11+
apt-get install -y curl wget make git unzip gnupg software-properties-common jq ca-certificates &&\
12+
## TerraForm: Prep
1313
(wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null) &&\
1414
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint &&\
1515
(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) &&\
16+
## Docker + QEMU + buildx: Prep
17+
install -m 0755 -d /etc/apt/keyrings &&\
18+
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc &&\
19+
chmod a+r /etc/apt/keyrings/docker.asc &&\
20+
(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) &&\
21+
## TerraForm: Prep
22+
## Docker + QEMU + buildx: Install
1623
apt-get update &&\
17-
apt-get install -y terraform &&\
24+
apt-get install -y terraform docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin qemu-user-static &&\
1825
## AWS CLI
1926
curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "/tmp/awscliv2.zip" &&\
2027
unzip /tmp/awscliv2.zip &&\
2128
./aws/install &&\
2229
rm /tmp/* -Rf &&\
30+
## Helm
2331
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 &&\
2432
chmod 700 get_helm.sh &&\
2533
./get_helm.sh &&\
2634
rm ./get_helm.sh &&\
27-
2835
## See https://github.com/actions/checkout/issues/956
2936
groupmod -g 1000 runner && usermod -u 1000 runner
3037

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ Also includes the following tools:
1313
* TerraForm
1414
* AWS CLI (v2)
1515
* Helm
16+
* Docker + QEMU + BuildX
1617

1718
Unlocks node v20 that is already available in the image

test/test_docker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pytest
2+
3+
def test_terraform(host):
4+
assert 'Hello from Docker!' in host.run('docker run hello-world').stdout
5+
assert 'This message shows that your installation appears to be working correctly.' in host.run('docker run hello-world').stdout

tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ declare -r DOCKER_TAG="$1"
1313

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

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

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

0 commit comments

Comments
 (0)