Some checks failed
Build and Push Docker Image / build (push) Failing after 9s
Root cause: act_runner provides minimal environment without sudo or Docker CLI. Cannot install packages in workflow. Solution: Use docker:24-dind container which includes Docker CLI and daemon. Runs with --privileged to allow nested containers. Changes: - Use docker:24-dind as job container - Remove installation steps (Docker pre-installed) - Keep simple login, build, push workflow Also added alternative solution file showing how to configure runner with Docker CLI for better performance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
81 lines
2.3 KiB
Plaintext
81 lines
2.3 KiB
Plaintext
# ALTERNATIVE SOLUTION: Configure runner with Docker CLI pre-installed
|
|
#
|
|
# This file shows how to set up the Gitea runner to have Docker CLI available
|
|
# by default, eliminating the need for Docker-in-Docker.
|
|
#
|
|
# SETUP INSTRUCTIONS:
|
|
#
|
|
# 1. SSH into your server where the Gitea runner is running
|
|
#
|
|
# 2. Find the runner container or installation:
|
|
# docker ps | grep act_runner
|
|
#
|
|
# 3. Option A: If runner is in Docker, create custom runner image
|
|
# Create a Dockerfile:
|
|
#
|
|
# FROM gitea/act_runner:latest
|
|
# RUN apk add --no-cache docker-cli
|
|
#
|
|
# Build and use:
|
|
# docker build -t gitea-runner-with-docker .
|
|
# # Update docker-compose or run command to use this image
|
|
#
|
|
# 4. Option B: If runner is installed on host, install Docker CLI:
|
|
#
|
|
# # For Ubuntu/Debian host
|
|
# curl -fsSL https://get.docker.com -o get-docker.sh
|
|
# sh get-docker.sh
|
|
#
|
|
# # Restart the runner service
|
|
# systemctl restart act_runner
|
|
#
|
|
# 5. Once Docker CLI is available in runner, use this simpler workflow:
|
|
|
|
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Verify Docker is available
|
|
run: docker version
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
run: |
|
|
echo "${{ secrets.GITHUB_TOKEN }}" | docker login code.puffinoffset.com -u ${{ github.actor }} --password-stdin
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t code.puffinoffset.com/matt/puffin-app:latest \
|
|
-t code.puffinoffset.com/matt/puffin-app:main-${{ github.sha }} \
|
|
.
|
|
|
|
- name: Push Docker images
|
|
run: |
|
|
docker push code.puffinoffset.com/matt/puffin-app:latest
|
|
docker push code.puffinoffset.com/matt/puffin-app:main-${{ github.sha }}
|
|
|
|
- name: Show image info
|
|
run: |
|
|
docker images | grep puffin-app
|
|
|
|
# BENEFITS OF THIS APPROACH:
|
|
# - Faster workflow execution (no container setup overhead)
|
|
# - Simpler workflow file
|
|
# - Better caching between builds
|
|
# - More control over runner environment
|
|
#
|
|
# WHEN TO USE:
|
|
# - If you have access to modify the runner
|
|
# - If you run multiple workflows that need Docker
|
|
# - For production environments where performance matters
|