Skip to content

Commit b50d7f8

Browse files
Merge pull request #20 from launchdarkly/feature/dockerize-and-ecr-push
adding Dockerfile. adding github action to push image to ecr.
2 parents 3b623d0 + e8c9b17 commit b50d7f8

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.devcontainer/*
2+
.github/*
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Docker Build and Push
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
env:
8+
ECR_REGISTRY: "709825985650.dkr.ecr.us-east-1.amazonaws.com/launchdarkly/mcp"
9+
jobs:
10+
build_push_image:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
- uses: zvonimirsun/read-package-version-actions@v2
18+
id: get-semver
19+
- uses: aws-actions/configure-aws-credentials@v4
20+
with:
21+
audience: "https://github.com/launchdarkly"
22+
role-to-assume: "arn:aws:iam::011970158519:role/mcp-server-ecr-publisher"
23+
role-session-name: "McpServerPublish"
24+
aws-region: "us-east-1"
25+
- uses: aws-actions/amazon-ecr-login@v2
26+
with:
27+
registries: "709825985650"
28+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
29+
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
30+
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
31+
with:
32+
context: .
33+
file: Dockerfile
34+
platforms: linux/amd64,linux/arm64
35+
tags: |
36+
${{ format('{0}:{1}', env.ECR_REGISTRY, steps.get-semver.outputs.version) }}
37+
labels: |
38+
org.opencontainers.image.title="mcp-server"
39+
org.opencontainers.image.description="LaunchDarkly MCP Server"
40+
org.opencontainers.image.version=${{ steps.get-semver.outputs.version }}
41+
push: ${{ github.ref == 'refs/heads/main' }}

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM oven/bun:1-debian AS builder
2+
3+
WORKDIR /app
4+
5+
COPY package*.json ./
6+
7+
RUN bun install
8+
9+
COPY . .
10+
11+
RUN bun run build
12+
13+
FROM gcr.io/distroless/nodejs24-debian12:970bec506fed86941afb61c21983f25b3b3fe68c
14+
15+
WORKDIR /app
16+
17+
# Copy built application from builder stage
18+
COPY --from=builder /app/dist ./dist
19+
COPY --from=builder /app/bin ./bin
20+
COPY --from=builder /app/package.json ./
21+
22+
EXPOSE 8080
23+
ENTRYPOINT ["/nodejs/bin/node", "/app/bin/mcp-server.js", "start", "--transport", "sse", "--port", "8080"]

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,36 @@ Some AI clients allow for accessing environment variables within MCP configurati
143143
}
144144
```
145145

146+
### Installation steps for Docker
147+
148+
If installing the MCP server from the AWS Markeplace, pull the image using an authenticated role using the provided instructions in the marketplace listing.
149+
150+
To run the container:
151+
152+
```bash
153+
docker run --rm -p 8080:8080 709825985650.dkr.ecr.us-east-1.amazonaws.com/launchdarkly/mcp --api-key api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
154+
```
155+
156+
Then, configure your server definition to reference your local clone. For example:
157+
158+
```json
159+
{
160+
"mcpServers": {
161+
"launchdarkly": {
162+
"command": "npx",
163+
"args": [
164+
"-y", "--package", "@launchdarkly/mcp-server", "--", "mcp", "start",
165+
"--api-key", "$LD_ACCESS_TOKEN"
166+
],
167+
"env": {
168+
"LD_ACCESS_TOKEN": "MCP_LD_TOKEN"
169+
}
170+
"url": "http://localhost:8080/sse"
171+
}
172+
}
173+
}
174+
```
175+
146176
This won't work in AI clients (such as Cursor) which don't support accessing environment variables directly within MCP configurations. As a workaround, you can invoke a local script from your MCP configuration. See [here](https://github.com/launchdarkly/mcp-server/issues/26#issuecomment-3064419507) for an example.
147177

148178
<!-- Start Requirements [requirements] -->

0 commit comments

Comments
 (0)