diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4790676 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +node_modules +.next +.git +.cursor +.DS_Store +npm-debug.log +test-results +coverage +*.tsbuildinfo +.env +.env.local +.env.development +.env.production diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..16a2236 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,66 @@ +name: Docker Publish + +on: + push: + branches: + - "**" + 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=() + ref_name="$(printf '%s' "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-' | tr -cd 'a-z0-9.-')" + if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then + tags+=("${IMAGE_NAME}:main") + elif [[ "${GITHUB_REF}" == refs/heads/* ]]; then + tags+=("${IMAGE_NAME}:${ref_name}") + fi + if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then + version="${GITHUB_REF#refs/tags/v}" + tags+=("${IMAGE_NAME}:${version}") + tags+=("${IMAGE_NAME}:latest") + 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", + }, + }, + ); +}