Files
overleaf-mcp/Dockerfile

69 lines
2.9 KiB
Docker

# ===============================================================
# Stage 1: Build mcp-auth-proxy from source
# ===============================================================
FROM golang:1.25-bookworm AS auth-proxy-builder
RUN git clone https://github.com/sigbit/mcp-auth-proxy.git /build \
&& cd /build \
&& go build -o /mcp-auth-proxy .
# ===============================================================
# Stage 2: Main image
# ===============================================================
FROM node:20-slim
# ---------------------------------------------------------------
# 1. System dependencies
# ---------------------------------------------------------------
RUN apt-get update && apt-get install -y \
git curl ca-certificates \
# Playwright / Chromium dependencies
libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
libpango-1.0-0 libcairo2 libasound2 libatspi2.0-0 \
libxshmfence1 libx11-xcb1 libxcb-dri3-0 libxfixes3 \
# TeX Live (base + common resume packages)
texlive-latex-base texlive-latex-extra texlive-fonts-recommended \
texlive-fonts-extra texlive-latex-recommended \
&& rm -rf /var/lib/apt/lists/*
# ---------------------------------------------------------------
# 2. Copy mcp-auth-proxy binary from builder
# ---------------------------------------------------------------
COPY --from=auth-proxy-builder /mcp-auth-proxy /usr/local/bin/mcp-auth-proxy
# ---------------------------------------------------------------
# 3. Clone and build the Overleaf MCP server
# ---------------------------------------------------------------
WORKDIR /app
RUN git clone https://github.com/Sahith59/OverLeaf_MCP.git . \
&& npm install \
&& npm run build
# ---------------------------------------------------------------
# 4. Install Playwright Chromium browser
# ---------------------------------------------------------------
RUN npx playwright install chromium
# ---------------------------------------------------------------
# 5. Force headless mode in the built code
# The source launches Playwright with headless:false (designed
# for desktop). We patch the compiled JS to force headless:true.
# ---------------------------------------------------------------
RUN find /app/dist -name '*.js' -exec sed -i \
-e 's/headless:\s*false/headless:true/g' \
-e 's/headless:!1/headless:true/g' \
-e "s/headless:!0/headless:true/g" \
{} +
# ---------------------------------------------------------------
# 5. Create data directories
# ---------------------------------------------------------------
RUN mkdir -p /data/resumes /data/output /root/.overleaf-mcp/browser-data
# ---------------------------------------------------------------
# 6. Expose HTTPS ports and start
# ---------------------------------------------------------------
EXPOSE 80 443
ENTRYPOINT ["mcp-auth-proxy"]