diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..15a7d55 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.devcontainer/* +.github/* diff --git a/.github/workflows/docker_build_and_push.yaml b/.github/workflows/docker_build_and_push.yaml new file mode 100644 index 0000000..8ca43bc --- /dev/null +++ b/.github/workflows/docker_build_and_push.yaml @@ -0,0 +1,41 @@ +name: Docker Build and Push +on: + push: + branches: + - main + +env: + ECR_REGISTRY: "709825985650.dkr.ecr.us-east-1.amazonaws.com/launchdarkly/mcp" +jobs: + build_push_image: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: zvonimirsun/read-package-version-actions@v2 + id: get-semver + - uses: aws-actions/configure-aws-credentials@v4 + with: + audience: "https://github.com/launchdarkly" + role-to-assume: "arn:aws:iam::011970158519:role/mcp-server-ecr-publisher" + role-session-name: "McpServerPublish" + aws-region: "us-east-1" + - uses: aws-actions/amazon-ecr-login@v2 + with: + registries: "709825985650" + - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 + - uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 + - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + tags: | + ${{ format('{0}:{1}', env.ECR_REGISTRY, steps.get-semver.outputs.version) }} + labels: | + org.opencontainers.image.title="mcp-server" + org.opencontainers.image.description="LaunchDarkly MCP Server" + org.opencontainers.image.version=${{ steps.get-semver.outputs.version }} + push: ${{ github.ref == 'refs/heads/main' }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d4432ed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM oven/bun:1-debian AS builder + +WORKDIR /app + +COPY package*.json ./ + +RUN bun install + +COPY . . + +RUN bun run build + +FROM gcr.io/distroless/nodejs24-debian12:970bec506fed86941afb61c21983f25b3b3fe68c + +WORKDIR /app + +# Copy built application from builder stage +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/bin ./bin +COPY --from=builder /app/package.json ./ + +EXPOSE 8080 +ENTRYPOINT ["/nodejs/bin/node", "/app/bin/mcp-server.js", "start", "--transport", "sse", "--port", "8080"] diff --git a/README.md b/README.md index 8f7244b..c24f222 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,28 @@ Then, configure your server definition to reference your local clone. For exampl } ``` +### Installation steps for Docker + +If installing the MCP server from the AWS Markeplace, pull the image using an authenticated role using the provided instructions in the marketplace listing. + +To run the container: + +```bash +docker run --rm -p 8080:8080 709825985650.dkr.ecr.us-east-1.amazonaws.com/launchdarkly/mcp --api-key api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +``` + +Then, configure your server definition to reference your local clone. For example: + +```json +{ + "mcpServers": { + "launchdarkly": { + "url": "http://localhost:8080/sse" + } + } +} +``` + ## Requirements