Update .gitea/workflows/dockerbuild.yml
Some checks failed
Build and Push Docker Image / build (push) Failing after 11s
Some checks failed
Build and Push Docker Image / build (push) Failing after 11s
This commit is contained in:
@@ -1,60 +1,37 @@
|
||||
name: Debug and Fix Docker Permissions
|
||||
name: Build and Push Docker Image
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
jobs:
|
||||
debug:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Debug Initial State
|
||||
- name: Add User to Docker Group and Refresh
|
||||
run: |
|
||||
echo "=== Initial Debug ==="
|
||||
whoami
|
||||
id
|
||||
groups
|
||||
ls -la /var/run/docker.sock
|
||||
sudo systemctl status docker
|
||||
|
||||
- name: Setup Docker
|
||||
run: |
|
||||
echo "=== Setting up Docker ==="
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker.io
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
|
||||
# Add user to docker group
|
||||
sudo usermod -aG docker ${{ github.actor }}
|
||||
|
||||
# Fix socket permissions
|
||||
if [ -S /var/run/docker.sock ]; then
|
||||
sudo chmod 666 /var/run/docker.sock
|
||||
fi
|
||||
|
||||
echo "=== After Setup ==="
|
||||
groups
|
||||
ls -la /var/run/docker.sock
|
||||
|
||||
- name: Test Docker Access
|
||||
run: |
|
||||
echo "=== Testing Docker Access ==="
|
||||
# This should work now
|
||||
docker --version
|
||||
echo "Current user groups: $(groups)"
|
||||
# Refresh the group membership for the current shell
|
||||
newgrp docker << 'EOF'
|
||||
echo "Testing with new group membership..."
|
||||
docker info
|
||||
|
||||
# Test with sudo as fallback
|
||||
sudo docker info
|
||||
|
||||
# Test with hello-world
|
||||
sudo docker run --rm hello-world
|
||||
|
||||
- name: Final Verification
|
||||
run: |
|
||||
echo "=== Final Verification ==="
|
||||
echo "User: $USER"
|
||||
echo "Groups: $(groups)"
|
||||
echo "Docker version: $(docker --version)"
|
||||
echo "Docker info (should work):"
|
||||
docker info | head -5
|
||||
EOF
|
||||
|
||||
- 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 }}
|
||||
Reference in New Issue
Block a user