name: Build and push image on: push: branches: - master jobs: build-and-push: runs-on: docker # Self-contained: don't depend on the runner injecting a docker CLI or # DOCKER_HOST into the default job image (observed not to be the case # in practice). actions/checkout needs Node, so use a node image and # install the docker CLI, talking to our own dind sidecar. Plain # `docker` commands (not buildx) so DOCKER_HOST is honored directly. container: node:20-bookworm services: docker: image: docker:27-dind options: --privileged env: DOCKER_HOST: tcp://docker:2375 steps: - name: Checkout uses: actions/checkout@v4 - name: Install Docker CLI run: | apt-get update apt-get install -y --no-install-recommends ca-certificates curl 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/debian $(. /etc/os-release && echo $VERSION_CODENAME) stable" \ > /etc/apt/sources.list.d/docker.list apt-get update apt-get install -y --no-install-recommends docker-ce-cli - name: Log in to Forgejo registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.rosenvold.tech -u "${{ github.actor }}" --password-stdin - name: Build image run: | docker build \ -t git.rosenvold.tech/lucas/rosenvold-core:latest \ -t git.rosenvold.tech/lucas/rosenvold-core:${{ github.sha }} \ -f Containerfile . - name: Push image run: docker push git.rosenvold.tech/lucas/rosenvold-core --all-tags