Spaces:
Runtime error
Runtime error
File size: 2,183 Bytes
cc08f98 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | FROM node:24-bullseye-slim
###############################################################################
# 1. Install everything we need in one layer
###############################################################################
RUN apt-get update && \
apt-get install -y --no-install-recommends \
# Basic tools
git ca-certificates python3 python3-pip build-essential make \
wget curl unzip \
# Chrome/Playwright deps copied from the first Dockerfile
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libdbus-1-3 \
libgbm-dev \
libnspr4 \
libnss3 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
xdg-utils \
libu2f-udev \
libvulkan1 \
# Virtual display for headless Chrome
xvfb \
&& rm -rf /var/lib/apt/lists/*
###############################################################################
# 2. Install Playwright and browsers globally (kept for future use)
###############################################################################
ENV PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright
RUN npx playwright install --with-deps chromium && \
chmod -R 777 /home/node/.cache/ms-playwright
###############################################################################
# 3. Startup script (clone repo at run-time like the second Dockerfile)
###############################################################################
COPY <<'start.sh' /usr/local/bin/start.sh
#!/usr/bin/env bash
set -e
echo "Cloning $REPO …"
git clone --depth 1 "$REPO" /tmp/app
cd /tmp/app
# (Optional) if your repo has devDependencies you need at runtime,
# drop the --omit=dev flag.
npm install --omit=dev
# Ensure the app can write wherever it needs
chmod -R 777 /tmp/app
exec npm start
start.sh
RUN chmod +x /usr/local/bin/start.sh
###############################################################################
# 4. Container metadata
###############################################################################
EXPOSE 7860
CMD ["/usr/local/bin/start.sh"] |