diff --git a/Dockerfile b/Dockerfile index 9e93266..f256676 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,5 +28,9 @@ RUN mkdir -p /home/playwright/.npm && chown -R playwright:playwright /home/playw # Switch to non-root user USER playwright +# Add health check to monitor container health +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD pgrep -f "@playwright/mcp" > /dev/null || exit 1 + # Set the entrypoint ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index af00025..e7a9207 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,10 +11,10 @@ if [ "$HEADLESS" = "true" ]; then MCP_ARGS="$MCP_ARGS --headless" fi -# Add --port if MCP_PORT is set (for SSE connection) -# This allows SSE connection even when HEADLESS=true +# Add --port and --host if MCP_PORT is set (for SSE connection) +# --host 0.0.0.0 is required so Docker port forwarding can reach the server if [ -n "$MCP_PORT" ]; then - MCP_ARGS="$MCP_ARGS --port $INTERNAL_PORT" + MCP_ARGS="$MCP_ARGS --port $INTERNAL_PORT --host 0.0.0.0" fi # Add --isolated if ISOLATED environment variable is true