fix(ci): install docker in container and mount host docker.sock
CI / Build Native (push) Failing after 0s

The container doesn't have docker, so docker build/docker push
fails with 'docker: not found'. Fix:

- Add docker.io to the apt-get install step (inside the container)
- Mount the host's docker.sock into the container via volumes:
  so the in-container docker CLI talks to the host's docker daemon
  (same model as Docker-in-Docker but using the host socket).

The runner has the docker label, so the host socket is available.
Now the whole pipeline (build native binary, build container image,
push to registry) runs in a single job without any artifact
upload/download between jobs.
This commit is contained in:
2026-08-12 19:26:13 -04:00
parent fb26361f85
commit 97dedd3424
+9 -4
View File
@@ -20,17 +20,20 @@ jobs:
container: container:
image: maven:3.9.6-eclipse-temurin-21 image: maven:3.9.6-eclipse-temurin-21
options: --memory=8g options: --memory=8g
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps: steps:
- name: Install git, node, gcc, and basic tools - name: Install git, node, gcc, docker, and basic tools
run: | run: |
apt-get update apt-get update
apt-get install -y git curl ca-certificates build-essential zlib1g-dev apt-get install -y git curl ca-certificates build-essential zlib1g-dev docker.io
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs apt-get install -y nodejs
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
git --version git --version
node --version node --version
gcc --version gcc --version
docker --version
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -73,11 +76,13 @@ jobs:
docker build -t shot-crafter-calculator:ci . docker build -t shot-crafter-calculator:ci .
echo "=== Login to Gitea Registry ===" echo "=== Login to Gitea Registry ==="
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.danielarroyo.cl -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.danielarroyo.cl -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
SHORT_SHA="${GITHUB_SHA::7}"
echo "=== Tag ===" echo "=== Tag ==="
docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${GITHUB_SHA::7} docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${SHORT_SHA}
echo "=== Push ===" echo "=== Push ==="
docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${GITHUB_SHA::7} docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${SHORT_SHA}
echo "=== Logout ===" echo "=== Logout ==="
docker logout gitea.danielarroyo.cl docker logout gitea.danielarroyo.cl
echo "=== Done ==="