Update Dockerfile
Browse files- Dockerfile +17 -12
Dockerfile
CHANGED
|
@@ -12,7 +12,6 @@ RUN apt-get update && \
|
|
| 12 |
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 13 |
apt-get install -y nodejs && \
|
| 14 |
# Install common Playwright browser dependencies
|
| 15 |
-
# Using --with-deps later helps, but pre-installing known ones is more robust
|
| 16 |
apt-get install -y --no-install-recommends \
|
| 17 |
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdbus-1-3 \
|
| 18 |
libdrm2 libgbm1 libgtk-3-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 \
|
|
@@ -34,22 +33,28 @@ RUN curl -fsSL https://bun.sh/install | bash
|
|
| 34 |
ENV BUN_INSTALL="/home/mcp/.bun"
|
| 35 |
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
|
| 36 |
|
| 37 |
-
# Switch back to root for global installations using pip
|
| 38 |
USER root
|
| 39 |
-
|
| 40 |
-
# Install mcpo and uv using pip
|
| 41 |
-
# Using --break-system-packages for newer pip versions in Debian base images if needed
|
| 42 |
-
# RUN pip install --no-cache-dir --break-system-packages mcpo uv
|
| 43 |
RUN pip install --no-cache-dir mcpo uv
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
RUN npx playwright install chromium --with-deps
|
| 49 |
|
| 50 |
-
#
|
| 51 |
-
|
| 52 |
-
# Set cache directory for tools like uv
|
|
|
|
| 53 |
ENV XDG_CACHE_HOME="/app/.cache"
|
| 54 |
|
| 55 |
# Switch back to non-root user for running the application
|
|
@@ -58,5 +63,5 @@ USER mcp
|
|
| 58 |
# Expose the port mcpo will listen on
|
| 59 |
EXPOSE 8000
|
| 60 |
|
| 61 |
-
# Set the entrypoint script
|
| 62 |
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
|
| 12 |
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 13 |
apt-get install -y nodejs && \
|
| 14 |
# Install common Playwright browser dependencies
|
|
|
|
| 15 |
apt-get install -y --no-install-recommends \
|
| 16 |
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdbus-1-3 \
|
| 17 |
libdrm2 libgbm1 libgtk-3-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 \
|
|
|
|
| 33 |
ENV BUN_INSTALL="/home/mcp/.bun"
|
| 34 |
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
|
| 35 |
|
| 36 |
+
# Switch back to root for global installations using pip
|
| 37 |
USER root
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
RUN pip install --no-cache-dir mcpo uv
|
| 39 |
|
| 40 |
+
# --- Playwright Installation Section (Revised) ---
|
| 41 |
+
|
| 42 |
+
# 1. Create the target Playwright cache directory AND set ownership EARLY
|
| 43 |
+
# This is the path where the error message indicates Playwright is looking.
|
| 44 |
+
RUN mkdir -p /app/.cache/ms-playwright && chown -R mcp:mcp /app/.cache
|
| 45 |
|
| 46 |
+
# 2. Set the environment variable to tell Playwright where to install/find browsers
|
| 47 |
+
# This applies to BOTH the build-time install command below AND the runtime environment.
|
| 48 |
+
ENV PLAYWRIGHT_BROWSERS_PATH="/app/.cache/ms-playwright"
|
| 49 |
+
|
| 50 |
+
# 3. Install Playwright browsers using npx (still as root, but targeting the owned directory)
|
| 51 |
+
# It *should* now respect the PLAYWRIGHT_BROWSERS_PATH
|
| 52 |
RUN npx playwright install chromium --with-deps
|
| 53 |
|
| 54 |
+
# --- End of Playwright Section ---
|
| 55 |
+
|
| 56 |
+
# Set general cache directory for other tools like uv
|
| 57 |
+
# Ensure the parent dir exists and is owned by mcp (already done above for ms-playwright)
|
| 58 |
ENV XDG_CACHE_HOME="/app/.cache"
|
| 59 |
|
| 60 |
# Switch back to non-root user for running the application
|
|
|
|
| 63 |
# Expose the port mcpo will listen on
|
| 64 |
EXPOSE 8000
|
| 65 |
|
| 66 |
+
# Set the entrypoint script (runs as mcp user)
|
| 67 |
ENTRYPOINT ["/app/entrypoint.sh"]
|