diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1846d3c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +node_modules +dist +.git +.github +docs +*.md +.env* +.vscode +.devcontainer +.npmrc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e0472f..ef96508 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -105,3 +105,39 @@ jobs: path: dist/ - run: npm publish --provenance --access public + + # ── 5. Build & push Docker image to GHCR ───────────────────────────── + docker-publish: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ inputs.tag }} + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=semver,pattern={{version}},value=${{ inputs.tag }} + type=semver,pattern={{major}}.{{minor}},value=${{ inputs.tag }} + type=semver,pattern={{major}},value=${{ inputs.tag }} + + - uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 68a157e..8b1c77d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,5 +10,6 @@ Initial public release. - Human-readable names accepted for countries and services - Idle HTTP session cleanup (30-minute TTL) - Set MCP server version from `package.json` +- Docker image published to GHCR (`ghcr.io/platfone-com/mcp`) - Documentation for installation, development, and security policy -- GitHub Actions for npm publish +- GitHub Actions for npm publish and Docker image build diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..937f6a1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# ── Build stage ───────────────────────────────────────────────────────── +FROM node:22-slim AS build + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm ci + +COPY tsconfig.json ./ +COPY src/ src/ +RUN npm run build + +# ── Production stage ─────────────────────────────────────────────────── +FROM node:22-slim + +LABEL org.opencontainers.image.source="https://github.com/platfone-com/mcp" +LABEL org.opencontainers.image.description="Platfone MCP server for SMS Activation" +LABEL org.opencontainers.image.licenses="MIT" + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm ci --omit=dev --ignore-scripts && npm cache clean --force + +COPY --from=build /app/dist/ dist/ + +# Default: stdio transport. Override CMD for HTTP: +# docker run -p 3000:3000 -e PLATFONE_API_KEY=… node dist/index.js --transport=http + +USER node + +CMD ["node", "dist/index.js"]