From 5d1c2a266b75b24026d309194c6caf63e7cfbfe5 Mon Sep 17 00:00:00 2001 From: Lukas Greve Date: Wed, 12 Nov 2025 21:33:15 +0000 Subject: [PATCH] Update .gitea/workflows/dockerbuild.yml --- .gitea/workflows/dockerbuild.yml | 77 +++++++++++--------------------- 1 file changed, 27 insertions(+), 50 deletions(-) diff --git a/.gitea/workflows/dockerbuild.yml b/.gitea/workflows/dockerbuild.yml index a462b5a..8f3fc6e 100644 --- a/.gitea/workflows/dockerbuild.yml +++ b/.gitea/workflows/dockerbuild.yml @@ -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 \ No newline at end of file + 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 }} \ No newline at end of file