Skip to content

Commit d546a5d

Browse files
committed
Add entrypoint script for optional connection flags
Simple entrypoint script that converts environment variables to command-line flags only when set: - BROWSER_URL → --browserUrl - WS_ENDPOINT → --wsEndpoint - WS_HEADERS → --wsHeaders This allows the server.yaml to pass these as env vars without causing build errors when they're empty.
1 parent 9fae624 commit d546a5d

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ WORKDIR /app
4545
COPY --from=builder /app/build ./build
4646
COPY --from=builder /app/node_modules ./node_modules
4747

48+
# Copy entrypoint script
49+
COPY docker-entrypoint.sh /usr/local/bin/
50+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
51+
4852
# Set environment to tell Puppeteer where Chromium is installed
4953
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
5054

@@ -56,5 +60,5 @@ RUN groupadd -r mcpuser && useradd -r -g mcpuser -G audio,video mcpuser \
5660

5761
USER mcpuser
5862

59-
# Expose MCP server via stdio
60-
ENTRYPOINT ["node", "build/src/index.js"]
63+
# Use entrypoint script that handles optional connection flags
64+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

docker-entrypoint.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Build command with optional connection arguments
5+
CMD="node build/src/index.js"
6+
7+
# Add browserUrl if BROWSER_URL is set and not empty
8+
if [ -n "$BROWSER_URL" ]; then
9+
CMD="$CMD --browserUrl $BROWSER_URL"
10+
fi
11+
12+
# Add wsEndpoint if WS_ENDPOINT is set and not empty
13+
if [ -n "$WS_ENDPOINT" ]; then
14+
CMD="$CMD --wsEndpoint $WS_ENDPOINT"
15+
fi
16+
17+
# Add wsHeaders if WS_HEADERS is set and not empty
18+
if [ -n "$WS_HEADERS" ]; then
19+
CMD="$CMD --wsHeaders '$WS_HEADERS'"
20+
fi
21+
22+
# Execute the command with any additional arguments
23+
exec $CMD "$@"

0 commit comments

Comments
 (0)