Update Dockerfile
Browse files- Dockerfile +14 -14
Dockerfile
CHANGED
|
@@ -21,6 +21,7 @@ RUN apt-get update && \
|
|
| 21 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
# Copy entrypoint script and make it executable
|
|
|
|
| 24 |
COPY entrypoint.sh /app/
|
| 25 |
RUN chmod +x /app/entrypoint.sh
|
| 26 |
|
|
@@ -37,27 +38,26 @@ ENV PATH="${BUN_INSTALL}/bin:${PATH}"
|
|
| 37 |
USER root
|
| 38 |
RUN pip install --no-cache-dir mcpo uv
|
| 39 |
|
| 40 |
-
# --- Playwright Installation Section
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
#
|
| 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
|
| 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
|
|
|
|
| 61 |
USER mcp
|
| 62 |
|
| 63 |
# Expose the port mcpo will listen on
|
|
|
|
| 21 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
# Copy entrypoint script and make it executable
|
| 24 |
+
# Note: At this point, /app is owned by root, but entrypoint.sh is copied in.
|
| 25 |
COPY entrypoint.sh /app/
|
| 26 |
RUN chmod +x /app/entrypoint.sh
|
| 27 |
|
|
|
|
| 38 |
USER root
|
| 39 |
RUN pip install --no-cache-dir mcpo uv
|
| 40 |
|
| 41 |
+
# --- Playwright Installation Section ---
|
| 42 |
+
# Create the target Playwright cache directory (owned by root initially)
|
| 43 |
+
RUN mkdir -p /app/.cache/ms-playwright
|
| 44 |
+
# Set the environment variable to tell Playwright where to install/find browsers
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
ENV PLAYWRIGHT_BROWSERS_PATH="/app/.cache/ms-playwright"
|
| 46 |
+
# Install Playwright browsers using npx (as root)
|
|
|
|
|
|
|
| 47 |
RUN npx playwright install chromium --with-deps
|
|
|
|
| 48 |
# --- End of Playwright Section ---
|
| 49 |
|
| 50 |
+
# Set general cache directory env var (directory created above)
|
|
|
|
| 51 |
ENV XDG_CACHE_HOME="/app/.cache"
|
| 52 |
|
| 53 |
+
# --- Change Ownership Section ---
|
| 54 |
+
# NOW, change ownership of the entire /app directory and its contents to mcp
|
| 55 |
+
# This includes /app/entrypoint.sh and /app/.cache and its contents (like playwright browsers)
|
| 56 |
+
RUN chown -R mcp:mcp /app
|
| 57 |
+
# --- End of Change Ownership Section ---
|
| 58 |
+
|
| 59 |
# Switch back to non-root user for running the application
|
| 60 |
+
# This user now owns /app and can write config.json into it.
|
| 61 |
USER mcp
|
| 62 |
|
| 63 |
# Expose the port mcpo will listen on
|