From 3983049d2c4d2161876c5938e6e14a68356f2a52 Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Tue, 31 Mar 2026 22:17:47 -0700 Subject: [PATCH] fix: use correct docker registry and image name --- .gitea/workflows/ci-image-builder.yml | 82 +++++++++++++-------------- .gitea/workflows/pr.yml | 21 +------ .gitea/workflows/test.yml | 9 +-- scripts/build-ci-image.sh | 8 +-- 4 files changed, 47 insertions(+), 73 deletions(-) diff --git a/.gitea/workflows/ci-image-builder.yml b/.gitea/workflows/ci-image-builder.yml index 05f057b..80f27c4 100644 --- a/.gitea/workflows/ci-image-builder.yml +++ b/.gitea/workflows/ci-image-builder.yml @@ -22,16 +22,15 @@ on: type: boolean env: - # Use GHCR or your own registry - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}/ci-runner + # Use your existing Docker registry + REGISTRY: docker.notsosm.art + IMAGE_NAME: euchre-camp-ci-runner jobs: - build-and-push: + build-ci-image: runs-on: ubuntu-latest - permissions: - contents: read - packages: write + # Skip if this is an auto-generated version bump commit + if: "!contains(github.event.head_commit.message, 'chore: bump version')" steps: - name: Checkout code @@ -40,42 +39,41 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=sha,prefix={{branch}}- - type=ref,event=branch - type=ref,event=pr - type=raw,value=latest,enable={{is_default_branch}} - - - name: Build and push CI image - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ci - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Update workflow documentation + - name: Build CI image run: | - echo "CI Image built and pushed successfully!" - echo "" - echo "Available tags:" - echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" - echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" + docker build \ + -f Dockerfile.ci \ + -t ${{ env.IMAGE_NAME }}:latest \ + -t ${{ env.IMAGE_NAME }}:$(git rev-parse --short HEAD) \ + . + + - name: Test CI image + run: | + docker run --rm \ + ${{ env.IMAGE_NAME }}:latest \ + sh -c "node --version && npm --version && npx prisma --version" + + - name: Push to registry + run: | + echo "Pushing to ${{ env.REGISTRY }}..." + # Check if we can authenticate to the registry using DOCKER_LOGIN and DOCKER_PASSWORD secrets + if [ -n "${{ secrets.DOCKER_LOGIN }}" ] && [ -n "${{ secrets.DOCKER_PASSWORD }}" ]; then + if docker login ${{ env.REGISTRY }} -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }} 2>/dev/null; then + docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + echo "Successfully pushed CI image to ${{ env.REGISTRY }}" + else + echo "Warning: Docker login failed with provided credentials" + echo "CI image built locally but not pushed to registry" + fi + else + echo "Warning: DOCKER_LOGIN or DOCKER_PASSWORD secrets not configured" + echo "CI image built locally but not pushed to registry" + fi + + - name: Show usage instructions + run: | + echo "CI Image built successfully!" echo "" echo "To use in workflows:" echo " container:" diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index 9a2660d..2b7d55a 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -9,20 +9,13 @@ jobs: unit-tests: runs-on: ubuntu-latest container: - image: node:20-alpine + image: docker.notsosm.art/euchre-camp-ci-runner:latest options: --user root steps: - - name: Install system dependencies - run: | - apk add --no-cache bash git - - name: Checkout code uses: actions/checkout@v4 - - name: Install dependencies - run: npm ci - - name: Run unit tests run: npm run test:run @@ -30,7 +23,7 @@ jobs: runs-on: ubuntu-latest needs: unit-tests container: - image: node:20-alpine + image: docker.notsosm.art/euchre-camp-ci-runner:latest options: --user root env: DATABASE_PROVIDER: sqlite @@ -38,19 +31,9 @@ jobs: BETTER_AUTH_SECRET: test-secret-key-for-ci-only steps: - - name: Install system dependencies - run: | - apk add --no-cache bash git - - name: Checkout code uses: actions/checkout@v4 - - name: Install dependencies - run: npm ci - - - name: Generate Prisma client - run: npx prisma generate - - name: Setup SQLite database run: | # Create SQLite database file diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index bcf53e3..ebf8657 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -9,21 +9,14 @@ jobs: unit-tests: runs-on: ubuntu-latest container: - image: node:20-alpine + image: docker.notsosm.art/euchre-camp-ci-runner:latest options: --user root # Skip if this is an auto-generated version bump commit (handled by release workflow) if: "!contains(github.event.head_commit.message, 'chore: bump version')" steps: - - name: Install system dependencies - run: | - apk add --no-cache bash git - - name: Checkout code uses: actions/checkout@v4 - - name: Install dependencies - run: npm ci - - name: Run unit tests run: npm run test:run diff --git a/scripts/build-ci-image.sh b/scripts/build-ci-image.sh index 8353fb8..403e356 100755 --- a/scripts/build-ci-image.sh +++ b/scripts/build-ci-image.sh @@ -3,7 +3,7 @@ set -e -IMAGE_NAME="euchre-camp-ci" +IMAGE_NAME="euchre-camp-ci-runner" TAG="${1:-latest}" echo "Building CI runner image..." @@ -37,8 +37,8 @@ echo "✅ CI image is ready to use!" echo "" echo "To use in GitHub Actions/Gitea Actions:" echo " container:" -echo " image: ${IMAGE_NAME}:${TAG}" +echo " image: docker.notsosm.art/${IMAGE_NAME}:${TAG}" echo "" echo "To push to registry:" -echo " docker tag ${IMAGE_NAME}:${TAG} registry.example.com/${IMAGE_NAME}:${TAG}" -echo " docker push registry.example.com/${IMAGE_NAME}:${TAG}" +echo " docker tag ${IMAGE_NAME}:${TAG} docker.notsosm.art/${IMAGE_NAME}:${TAG}" +echo " docker push docker.notsosm.art/${IMAGE_NAME}:${TAG}"