diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..34e95a0 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,66 @@ +name: Docker Publish + +on: + push: + branches: + - main + tags: + - "v*" + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/claw3d + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare Docker tags + id: tags + shell: bash + run: | + set -euo pipefail + tags=() + if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then + tags+=("${IMAGE_NAME}:main") + fi + if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then + version="${GITHUB_REF#refs/tags/v}" + tags+=("${IMAGE_NAME}:${version}") + tags+=("${IMAGE_NAME}:latest") + fi + if [[ ${#tags[@]} -eq 0 ]]; then + tags+=("${IMAGE_NAME}:manual") + fi + { + echo "value<> "$GITHUB_OUTPUT" + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.tags.outputs.value }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/src/app/api/health/route.ts b/src/app/api/health/route.ts new file mode 100644 index 0000000..056c88c --- /dev/null +++ b/src/app/api/health/route.ts @@ -0,0 +1,17 @@ +import { NextResponse } from "next/server"; + +export const runtime = "nodejs"; + +export async function GET() { + return NextResponse.json( + { + ok: true, + service: "claw3d", + }, + { + headers: { + "Cache-Control": "no-store", + }, + }, + ); +}