ig-api / Dockerfile
EmmyHenz001's picture
Create Dockerfile
cc08f98 verified
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"]