Files
Hermes Agent 345a9c12c6
CI / Build on Node 18 (push) Canceled after 0s
CI / Build on Node 20 (push) Canceled after 0s
CI / Build on Node 22 (push) Canceled after 0s
CI / Docker image builds (push) Canceled after 0s
Add Surfshark WireGuard tunnel and public Streamable HTTP endpoint
mcp-maigret speaks stdio only, so it had no way to be deployed behind a VPN
with a domain. This wraps it in Gluetun (Surfshark, WireGuard) and publishes
it over HTTPS via supergateway.

- docker-compose.yml: gluetun sidecar + maigret-mcp in its network namespace,
  so all maigret egress leaves through the tunnel. No ports, no networks on
  the app; domain attaches to gluetun:8000 because the app has no IP of its own.
- Dockerfile: bake supergateway@4.2.2 into the image so a restart never depends
  on the npm registry.
- entrypoint is overridden rather than command, because the image's ENTRYPOINT
  is ["node","build/index.js"] and command only replaces CMD.
- MAIGRET_RUNNER=local is required: the docker runner would spawn a sibling
  container outside the namespace and defeat the VPN.
- Public endpoint requires a bearer token (supergateway --apiKey), healthcheck
  is a real MCP-aware probe, not a port check.
- DEPLOY.md documents deployment, routing, and verification.
2026-11-21 10:15:28 +00:00

62 lines
2.0 KiB
Docker

# Use the official Node.js 24 LTS image as the base image
FROM node:24-slim AS build
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./
# Install the project dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Create a new stage for the production image
FROM node:24-slim
# Set the working directory in the container
WORKDIR /app
# Copy the built application from the build stage
COPY --from=build /app/build /app/build
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/package-lock.json /app/package-lock.json
# Install only production dependencies
RUN npm ci --omit=dev
# --- Added for the Coolify + VPN deployment (see DEPLOY.md) ------------------
# This MCP server only speaks stdio (src/index.ts uses StdioServerTransport), so
# there is no port to publish. supergateway wraps it as Streamable HTTP so it can
# be served behind a domain. Baked into the image rather than fetched with `npx`
# at boot, so a container restart never depends on the npm registry.
RUN npm install -g supergateway@4.2.2
# Bundle maigret (with the pdf extra) so the image runs without a Docker daemon,
# for example on hosted MCP platforms. Pinned for reproducible results (#22).
ARG MAIGRET_VERSION=0.6.6
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-venv \
&& rm -rf /var/lib/apt/lists/* \
&& python3 -m venv /opt/maigret \
&& /opt/maigret/bin/pip install --no-cache-dir "maigret[pdf]==${MAIGRET_VERSION}" \
&& /opt/maigret/bin/maigret --version
ENV PATH=/opt/maigret/bin:$PATH
ENV MAIGRET_RUNNER=local
# Set environment variable for the reports directory
ENV MAIGRET_REPORTS_DIR=/app/reports
# Create the reports directory
RUN mkdir -p $MAIGRET_REPORTS_DIR
# Expose the port on which the application will run
EXPOSE 3000
# Command to run the application
ENTRYPOINT ["node", "build/index.js"]