diff --git a/.gitea/workflows/dockerbuild.yml b/.gitea/workflows/dockerbuild.yml index f48c9f3..a462b5a 100644 --- a/.gitea/workflows/dockerbuild.yml +++ b/.gitea/workflows/dockerbuild.yml @@ -1,23 +1,60 @@ -name: Build with DinD +name: Debug and Fix Docker Permissions on: push: branches: [ main ] jobs: - build: + debug: runs-on: ubuntu-latest - container: - image: docker:dind - options: --privileged steps: - 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 run: | + echo "=== Testing Docker Access ===" + # This should work now docker --version 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: | - docker build -t my-image:${{ github.sha }} . - # Your push commands here \ No newline at end of file + echo "=== Final Verification ===" + echo "User: $USER" + echo "Groups: $(groups)" + echo "Docker version: $(docker --version)" + echo "Docker info (should work):" + docker info | head -5 \ No newline at end of file