Files
fedora-runner-image/.gitea/workflows/dockerbuild.yml
Lukas Greve ad5cf58216
Some checks failed
Build and Push Docker Image / build (push) Failing after 57s
Update .gitea/workflows/dockerbuild.yml
2025-11-12 21:18:56 +00:00

92 lines
2.8 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Debug Environment
run: |
echo "=== System Information ==="
uname -a
cat /etc/os-release
echo "=== User Information ==="
whoami
id
groups
echo "=== Docker Setup ==="
which docker || echo "Docker not installed"
sudo systemctl status docker || echo "Docker service not running"
echo "=== Docker Socket ==="
ls -la /var/run/docker.sock || echo "No docker socket found"
- name: Install Docker
run: |
sudo apt-get update
sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker
- name: Add User to Docker Group
run: |
echo "Adding user to docker group..."
sudo usermod -aG docker ${{ github.actor }}
echo "Current groups after modification:"
groups
# Test the group membership
id ${{ github.actor }}
- name: Test Docker Access
run: |
echo "=== Testing Docker Access ==="
# Test without sudo (should work after usermod)
docker --version || echo "Docker command failed"
# Test with sudo (fallback)
sudo docker --version || echo "Sudo Docker failed"
# Test basic Docker functionality
docker info || echo "Docker info failed"
# Test with a simple container
docker run --rm hello-world || echo "Hello world test failed"
- name: Final Debug Check
run: |
echo "=== Final Debug Check ==="
echo "User: $USER"
echo "Groups: $(groups)"
echo "Docker version:"
docker --version
echo "Docker info:"
docker info | head -10
- name: Setup Docker
run: |
sudo apt-get update
sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $user
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: git.phyllo.me
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
git.phyllo.me/devops/fedora-runner-image:${{ github.ref_name }}-${{ github.sha }}
git.phyllo.me/devops/fedora-runner-image:${{ github.ref_name }}-latest
build-args: |
BUILD_IDENTIFIER=${{ github.sha }}