From 49d199fca294947b779618ab87d5f8c0f3736d3f Mon Sep 17 00:00:00 2001 From: NexVeridian Date: Fri, 22 Aug 2025 00:57:07 -0700 Subject: [PATCH] fix: docker --- .forgejo/workflows/docker.yml | 50 +++++++++++------------------------ 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/.forgejo/workflows/docker.yml b/.forgejo/workflows/docker.yml index 278a963..f350839 100644 --- a/.forgejo/workflows/docker.yml +++ b/.forgejo/workflows/docker.yml @@ -1,36 +1,20 @@ name: docker on: - # workflow_run: - # workflows: [crane] push: branches: [main] - # types: - # - completed - # schedule: - # - cron: 0 0 * * 1 - # # Publish semver tags as releases. - # tags: [ 'v*.*.*' ] - # pull_request: - # branches: [ "main" ] env: - # Use docker.io for Docker Hub if empty REGISTRY: git.nexveridian.com - # github.repository as / IMAGE_NAME: ${{ github.repository }} NIX_CONFIG: "experimental-features = nix-command flakes" jobs: build: runs-on: docker - # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow - # if: ${{ github.event.workflow_run.conclusion == 'success' }} permissions: contents: read packages: write - # This is used to complete the identity challenge - # with sigstore/fulcio when running outside of PRs. id-token: write steps: @@ -56,37 +40,33 @@ jobs: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Log into registry ${{ env.REGISTRY }} - if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} - username: ${{ env.GITHUB_ACTOR }} - password: ${{ env.GITHUB_TOKEN }} - - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build Nix package run: nix build .#my-docker - # https://github.com/orgs/community/discussions/25768#discussioncomment-3249183 - - name: Downcase REPO + - name: Prepare repository variables run: | echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} - - - name: Strip REPO Username - run: | - STRIP_REPO_USERNAME=${REPO#nexveridian/} + STRIP_REPO_USERNAME=${GITHUB_REPOSITORY,,#nexveridian/} echo "STRIP_REPO_USERNAME=${STRIP_REPO_USERNAME}" >> ${GITHUB_ENV} - # https://github.com/docker/build-push-action/issues/538 - - name: Push and tag Docker image + - name: Load, tag and push Docker image + env: + DOCKER_HOST: tcp://docker-in-docker:2375 run: | + echo "Docker host: $DOCKER_HOST" + echo "Testing Docker connection..." + docker version + echo "Loading Docker image..." docker load < result + echo "Tagging image..." docker tag ${{ env.STRIP_REPO_USERNAME }}:latest ${{ env.REGISTRY }}/${{ env.REPO }}:latest + echo "Pushing image..." docker push ${{ env.REGISTRY }}/${{ env.REPO }}:latest - name: Push to attic @@ -100,7 +80,7 @@ jobs: done if [ -n "$valid_paths" ]; then - for i in {1..10}; do - nix run -I nixpkgs=channel:nixos-unstable nixpkgs#attic-client push nexveridian-web $valid_paths && break || [ $i -eq 5 ] || sleep 5 + for i in {1..3}; do + nix run -I nixpkgs=channel:nixos-unstable nixpkgs#attic-client push nexveridian-web $valid_paths && break || [ $i -eq 3 ] || sleep 5 done fi