Update Dockerfile
Browse files- Dockerfile +18 -1
Dockerfile
CHANGED
|
@@ -1,31 +1,48 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
|
|
|
| 3 |
RUN useradd -ms /bin/bash mcp
|
| 4 |
|
| 5 |
WORKDIR /app
|
| 6 |
|
|
|
|
| 7 |
RUN apt-get update && \
|
| 8 |
apt-get install -y curl unzip && \
|
| 9 |
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 10 |
apt-get install -y nodejs && \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 12 |
|
|
|
|
| 13 |
COPY entrypoint.sh /app/
|
| 14 |
RUN chmod +x /app/entrypoint.sh
|
| 15 |
|
|
|
|
| 16 |
USER mcp
|
| 17 |
RUN curl -fsSL https://bun.sh/install | bash
|
| 18 |
|
|
|
|
| 19 |
ENV BUN_INSTALL="/home/mcp/.bun"
|
| 20 |
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
|
| 21 |
|
|
|
|
| 22 |
USER root
|
|
|
|
|
|
|
| 23 |
RUN pip install --no-cache-dir mcpo uv
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
| 26 |
|
|
|
|
|
|
|
| 27 |
ENV XDG_CACHE_HOME="/app/.cache"
|
| 28 |
|
|
|
|
| 29 |
USER mcp
|
| 30 |
|
| 31 |
EXPOSE 8000
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
# Create a non-root user
|
| 4 |
RUN useradd -ms /bin/bash mcp
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Install Node.js, curl, unzip, and system dependencies for Playwright
|
| 9 |
RUN apt-get update && \
|
| 10 |
apt-get install -y curl unzip && \
|
| 11 |
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 12 |
apt-get install -y nodejs && \
|
| 13 |
+
# Install Playwright browser dependencies BEFORE installing playwright itself
|
| 14 |
+
apt-get install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdbus-1-3 \
|
| 15 |
+
libdrm2 libgbm1 libgtk-3-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 \
|
| 16 |
+
libxfixes3 libxrandr2 libxtst6 libasound2 libpango-1.0-0 libcairo2 libatspi2.0-0 && \
|
| 17 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# Copy entrypoint script and make it executable
|
| 20 |
COPY entrypoint.sh /app/
|
| 21 |
RUN chmod +x /app/entrypoint.sh
|
| 22 |
|
| 23 |
+
# Switch to non-root user for Bun installation
|
| 24 |
USER mcp
|
| 25 |
RUN curl -fsSL https://bun.sh/install | bash
|
| 26 |
|
| 27 |
+
# Add Bun to PATH
|
| 28 |
ENV BUN_INSTALL="/home/mcp/.bun"
|
| 29 |
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
|
| 30 |
|
| 31 |
+
# Switch back to root for global installations
|
| 32 |
USER root
|
| 33 |
+
|
| 34 |
+
# Install mcpo and uv using pip
|
| 35 |
RUN pip install --no-cache-dir mcpo uv
|
| 36 |
|
| 37 |
+
# Install Playwright and Chromium globally using npx
|
| 38 |
+
# --with-deps attempts to install needed OS libraries, though we added common ones above
|
| 39 |
+
RUN npx playwright install chromium --with-deps
|
| 40 |
|
| 41 |
+
# Create cache directory and set ownership
|
| 42 |
+
RUN mkdir -p /app/.cache/uv && chown -R mcp:mcp /app
|
| 43 |
ENV XDG_CACHE_HOME="/app/.cache"
|
| 44 |
|
| 45 |
+
# Switch back to non-root user for running the application
|
| 46 |
USER mcp
|
| 47 |
|
| 48 |
EXPOSE 8000
|