Update .gitea/workflows/dockerbuild.yml
Some checks failed
Debug and Fix Docker Permissions / debug (push) Failing after 8s
Some checks failed
Debug and Fix Docker Permissions / debug (push) Failing after 8s
This commit is contained in:
@@ -1,23 +1,60 @@
|
|||||||
name: Build with DinD
|
name: Debug and Fix Docker Permissions
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
debug:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: docker:dind
|
|
||||||
options: --privileged
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Debug Initial State
|
||||||
|
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
|
- name: Test Docker Access
|
||||||
run: |
|
run: |
|
||||||
|
echo "=== Testing Docker Access ==="
|
||||||
|
# This should work now
|
||||||
docker --version
|
docker --version
|
||||||
docker info
|
docker info
|
||||||
docker run --rm hello-world
|
|
||||||
|
|
||||||
- name: Build and Push
|
# Test with sudo as fallback
|
||||||
|
sudo docker info
|
||||||
|
|
||||||
|
# Test with hello-world
|
||||||
|
sudo docker run --rm hello-world
|
||||||
|
|
||||||
|
- name: Final Verification
|
||||||
run: |
|
run: |
|
||||||
docker build -t my-image:${{ github.sha }} .
|
echo "=== Final Verification ==="
|
||||||
# Your push commands here
|
echo "User: $USER"
|
||||||
|
echo "Groups: $(groups)"
|
||||||
|
echo "Docker version: $(docker --version)"
|
||||||
|
echo "Docker info (should work):"
|
||||||
|
docker info | head -5
|
||||||
Reference in New Issue
Block a user