From 3b3ed947412b19a43e6645d6a589506e969f1194 Mon Sep 17 00:00:00 2001 From: malladi nagarjuna Date: Sun, 26 Apr 2026 03:18:18 +0530 Subject: [PATCH] moved the conformance server dockerfile to upstream --- .github/workflows/ci.yml | 54 ++++++++++++++++++++++++++++++++++++++++ dockerfile | 32 ++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea43b519..0116299c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,3 +62,57 @@ jobs: else npm publish --access public fi + + publish-docker: + runs-on: ubuntu-latest + # Triggers on official releases or manual alpha builds, matching NPM publish logic + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_alpha == 'true') + needs: [test] + permissions: + contents: read + packages: write + attestations: write + id-token: write + steps: + - uses: actions/checkout@v6 + + - name: Log in to the Container registry + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v6 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=semver,pattern={{version}} + type=raw,value=alpha,enable=${{ github.event.inputs.publish_alpha == 'true' }} + type=edge,branch=main + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v6 + with: + context: . + file: dockerfile + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v4 + with: + subject-name: ghcr.io/${{ github.repository }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/dockerfile b/dockerfile new file mode 100644 index 00000000..0b16a949 --- /dev/null +++ b/dockerfile @@ -0,0 +1,32 @@ +# Stage 1: Build +FROM mirror.gcr.io/node:24-alpine AS builder + +WORKDIR /app + +# Copy package files from the local typescript example folder +# Note: Path is relative to the root of the conformance repo +COPY examples/servers/typescript/package*.json ./ + +# Install all dependencies (including devDependencies needed for tsx) +RUN npm ci + +# Copy the rest of the server source code +COPY examples/servers/typescript/ ./ + +# Stage 2: Production Release +FROM mirror.gcr.io/node:24-alpine AS release + +WORKDIR /app + +# Copy only necessary built files and node_modules from builder stage +COPY --from=builder /app/ ./ + +# Set production environment variables +ENV NODE_ENV=production +ENV PORT=3000 + +# Document the port usage +EXPOSE 3000 + +# Execution command +CMD ["npm", "start"] \ No newline at end of file