Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
32 changes: 32 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -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"]