Skip to content

Commit 890f6fd

Browse files
authored
Dockerfile (#1)
* Initial work for adding a Dockerfile and creating an image for inspector Fixes modelcontextprotocol#237 * Updating workflow to publish to GitHub Container Registry Using guide from https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
1 parent 6ab7ac3 commit 890f6fd

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

.dockerignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Version control
2+
.git
3+
.gitignore
4+
5+
# Node.js
6+
node_modules
7+
npm-debug.log
8+
9+
# Build artifacts
10+
client/dist
11+
client/build
12+
server/dist
13+
server/build
14+
15+
# Environment variables
16+
.env
17+
.env.local
18+
.env.development
19+
.env.test
20+
.env.production
21+
22+
# Editor files
23+
.vscode
24+
.idea
25+
26+
# Logs
27+
logs
28+
*.log
29+
30+
# Testing
31+
coverage
32+
33+
# Docker
34+
Dockerfile
35+
.dockerignore

.github/workflows/main.yml

+40
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,43 @@ jobs:
6060
- run: npm run publish-all
6161
env:
6262
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
64+
publish-github-container-registry:
65+
runs-on: ubuntu-latest
66+
if: github.event_name == 'release'
67+
environment: release
68+
needs: build
69+
permissions:
70+
contents: write
71+
id-token: write
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Log in to the Container registry
76+
uses: docker/login-action@v3
77+
with:
78+
registry: ghcr.io
79+
username: ${{ github.actor }}
80+
password: ${{ secrets.GITHUB_TOKEN }}
81+
82+
- name: Extract metadata (tags, labels) for Docker
83+
id: meta
84+
uses: docker/metadata-action@v5
85+
with:
86+
images: ghcr.io/${{ github.repository }}
87+
88+
- name: Build and push Docker image
89+
id: push
90+
uses: docker/build-push-action@v6
91+
with:
92+
context: .
93+
push: true
94+
tags: ${{ steps.meta.outputs.tags }}
95+
labels: ${{ steps.meta.outputs.labels }}
96+
97+
- name: Generate artifact attestation
98+
uses: actions/attest-build-provenance@v2
99+
with:
100+
subject-name: ghcr.io/${{ github.repository }}
101+
subject-digest: ${{ steps.push.outputs.digest }}
102+
push-to-registry: true

Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:22-slim
2+
3+
# Set working directory
4+
WORKDIR /app
5+
6+
# Copy files
7+
COPY . .
8+
9+
# Install dependencies
10+
# Working around https://github.com/npm/cli/issues/4828
11+
# RUN npm ci
12+
RUN npm install --no-package-lock
13+
14+
# Build the application
15+
RUN npm run build
16+
17+
ENV CLIENT_PORT=6274
18+
ENV SERVER_PORT=6277
19+
20+
# Expose the CLIENT_PORT and SERVER_PORT
21+
EXPOSE $CLIENT_PORT
22+
EXPOSE $SERVER_PORT
23+
24+
# Use ENTRYPOINT with CMD for arguments
25+
ENTRYPOINT ["npm", "start"]
26+
CMD []

0 commit comments

Comments
 (0)