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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
jobs:
|
jobs:
|
||||||
debug:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Debug Initial State
|
- name: Add User to Docker Group and Refresh
|
||||||
run: |
|
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 }}
|
sudo usermod -aG docker ${{ github.actor }}
|
||||||
|
echo "Current user groups: $(groups)"
|
||||||
# Fix socket permissions
|
# Refresh the group membership for the current shell
|
||||||
if [ -S /var/run/docker.sock ]; then
|
newgrp docker << 'EOF'
|
||||||
sudo chmod 666 /var/run/docker.sock
|
echo "Testing with new group membership..."
|
||||||
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
|
|
||||||
docker info
|
docker info
|
||||||
|
EOF
|
||||||
|
|
||||||
# Test with sudo as fallback
|
- name: Login to Registry
|
||||||
sudo docker info
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.phyllo.me
|
||||||
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
# Test with hello-world
|
- name: Build and Push Docker Image
|
||||||
sudo docker run --rm hello-world
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
- name: Final Verification
|
context: .
|
||||||
run: |
|
push: true
|
||||||
echo "=== Final Verification ==="
|
tags: |
|
||||||
echo "User: $USER"
|
git.phyllo.me/devops/fedora-runner-image:${{ github.ref_name }}-${{ github.sha }}
|
||||||
echo "Groups: $(groups)"
|
git.phyllo.me/devops/fedora-runner-image:${{ github.ref_name }}-latest
|
||||||
echo "Docker version: $(docker --version)"
|
build-args: |
|
||||||
echo "Docker info (should work):"
|
BUILD_IDENTIFIER=${{ github.sha }}
|
||||||
docker info | head -5
|
|
||||||
Reference in New Issue
Block a user