feat(ci): build custom Docker images for Gitea Actions compatibility
- Create Dockerfile.ci-base with Bun, Node.js, and Playwright pre-installed - Add build-ci-images workflow that triggers on package.json changes - Update PR workflow to use custom ci-base image instead of GitHub Actions - Update Release workflow to use custom ci-base image - Remove dependency on oven/setup-bun@v2 GitHub Action - Remove dependency on docker/setup-buildx-action GitHub Action - Images are automatically built when dependencies in package.json update - Weekly scheduled rebuild ensures tools stay current This resolves the 'authentication required: Repository not found' error when Gitea Actions tries to clone GitHub Actions from external repositories.
This commit is contained in:
@@ -0,0 +1,71 @@
|
|||||||
|
name: Build CI Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'Dockerfile.ci-base'
|
||||||
|
- 'package.json'
|
||||||
|
- 'bun.lockb'
|
||||||
|
- '.gitea/workflows/build-ci-images.yml'
|
||||||
|
schedule:
|
||||||
|
# Weekly rebuild to get latest Playwright/Bun versions
|
||||||
|
- cron: '0 2 * * 0' # Every Sunday at 2 AM
|
||||||
|
workflow_dispatch: # Manual trigger
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.notsosm.art
|
||||||
|
IMAGE_NAME: euchre-camp
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-ci-base:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u ${{ secrets.DOCKER_LOGIN }} --password-stdin
|
||||||
|
|
||||||
|
- name: Extract metadata for CI base image
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
# Get Playwright version from package.json
|
||||||
|
PLAYWRIGHT_VERSION=$(grep -o '"@playwright/test": "[^"]*"' package.json | cut -d'"' -f4)
|
||||||
|
echo "playwright_version=${PLAYWRIGHT_VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Get Bun version (latest)
|
||||||
|
BUN_VERSION=$(bun --version 2>/dev/null || echo "latest")
|
||||||
|
echo "bun_version=${BUN_VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Set tags
|
||||||
|
echo "tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:playwright-${PLAYWRIGHT_VERSION},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:${{ github.sha }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build and push CI base image
|
||||||
|
run: |
|
||||||
|
# Build with multiple tags
|
||||||
|
docker build \
|
||||||
|
--file Dockerfile.ci-base \
|
||||||
|
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:latest \
|
||||||
|
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:playwright-${{ steps.meta.outputs.playwright_version }} \
|
||||||
|
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:${{ github.sha }} \
|
||||||
|
.
|
||||||
|
|
||||||
|
# Push all tags
|
||||||
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:latest
|
||||||
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:playwright-${{ steps.meta.outputs.playwright_version }}
|
||||||
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Clean up
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
docker logout ${{ env.REGISTRY }}
|
||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: oven/bun:alpine
|
image: docker.notsosm.art/euchre-camp/ci-base:latest
|
||||||
options: --user root
|
options: --user root
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: unit-tests
|
needs: unit-tests
|
||||||
container:
|
container:
|
||||||
image: mcr.microsoft.com/playwright:v1.58.0-jammy
|
image: docker.notsosm.art/euchre-camp/ci-base:latest
|
||||||
options: --user root
|
options: --user root
|
||||||
env:
|
env:
|
||||||
DATABASE_PROVIDER: sqlite
|
DATABASE_PROVIDER: sqlite
|
||||||
@@ -42,11 +42,6 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: oven/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: latest
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install
|
run: bun install
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Skip if this is an auto-generated version bump commit
|
# Skip if this is an auto-generated version bump commit
|
||||||
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
||||||
|
container:
|
||||||
|
image: docker.notsosm.art/euchre-camp/ci-base:latest
|
||||||
|
options: --user root
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -63,11 +66,6 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: oven/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: latest
|
|
||||||
|
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
@@ -109,10 +107,6 @@ jobs:
|
|||||||
git push origin "$TAG_NAME"
|
git push origin "$TAG_NAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
if: steps.commit.outputs.committed == 'true'
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Build test-capable image
|
- name: Build test-capable image
|
||||||
if: steps.commit.outputs.committed == 'true'
|
if: steps.commit.outputs.committed == 'true'
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# Base CI image with Bun, Node.js, Playwright, and build tools
|
||||||
|
# Used for Gitea Actions CI workflows
|
||||||
|
# Uses Microsoft Playwright image as base (Ubuntu-based) with Bun added
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/playwright:v1.58.0-jammy AS base
|
||||||
|
|
||||||
|
# Install unzip (required for Bun installation) and other tools
|
||||||
|
RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Bun (latest version)
|
||||||
|
# Note: The playwright image already has Node.js pre-installed
|
||||||
|
RUN curl -fsSL https://bun.sh/install | bash
|
||||||
|
|
||||||
|
# Add Bun to PATH for subsequent commands
|
||||||
|
ENV PATH="/root/.bun/bin:$PATH"
|
||||||
|
|
||||||
|
# Verify installations
|
||||||
|
RUN echo "=== Bun Version ===" && bun --version && \
|
||||||
|
echo "=== Node.js Version ===" && node --version && \
|
||||||
|
echo "=== Playwright Version ===" && bun x playwright --version
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Set default environment variables
|
||||||
|
ENV DATABASE_PROVIDER=sqlite
|
||||||
|
ENV DATABASE_URL=file:./prisma/ci.db
|
||||||
|
ENV BETTER_AUTH_SECRET=test-secret-key-for-ci-only
|
||||||
|
ENV NODE_ENV=test
|
||||||
|
|
||||||
|
# Health check command (can be overridden)
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD bun --version
|
||||||
Reference in New Issue
Block a user