Update .gitea/workflows/dockerbuild.yml
This commit is contained in:
@@ -8,70 +8,31 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Debug Environment
|
- name: Detailed Debug Info
|
||||||
run: |
|
run: |
|
||||||
echo "=== System Information ==="
|
# Check if we're in a container
|
||||||
uname -a
|
echo "Running in container: ${{ contains(github.runner_os, 'Linux') }}"
|
||||||
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
|
# Check file permissions
|
||||||
run: |
|
echo "Docker socket permissions:"
|
||||||
sudo apt-get update
|
ls -la /var/run/docker.sock
|
||||||
sudo apt-get install -y docker.io
|
|
||||||
sudo systemctl start docker
|
|
||||||
sudo systemctl enable docker
|
|
||||||
|
|
||||||
- name: Add User to Docker Group
|
# Check if docker group exists
|
||||||
run: |
|
echo "Docker group info:"
|
||||||
echo "Adding user to docker group..."
|
getent group docker
|
||||||
sudo usermod -aG docker ${{ github.actor }}
|
|
||||||
echo "Current groups after modification:"
|
|
||||||
groups
|
|
||||||
|
|
||||||
# Test the group membership
|
# Check if we can run docker commands
|
||||||
id ${{ github.actor }}
|
echo "Testing docker commands:"
|
||||||
|
if command -v docker &> /dev/null; then
|
||||||
|
echo "Docker is installed"
|
||||||
|
docker --version
|
||||||
|
else
|
||||||
|
echo "Docker not installed"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Test Docker Access
|
# Check user membership
|
||||||
run: |
|
echo "User membership:"
|
||||||
echo "=== Testing Docker Access ==="
|
groups $USER
|
||||||
# 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
|
- name: Login to Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
|||||||
Reference in New Issue
Block a user