Spaces:
Sleeping
Sleeping
harsh
Claude Sonnet 4.6
fix(puppeteer): add --disable-ipv6 --single-process for HF Spaces ERR_TIMED_OUT
b5fa2db Download Dockerfile.selfhosted from jinksQspider/openWa: direct link, hf CLI and curl.
- Browser
- Download file 2.45 kB
-
https://huggingface.co/spaces/jinksQspider/openWa/resolve/main/Dockerfile.selfhosted
- Command line
-
hf download hf://spaces/jinksQspider/openWa/Dockerfile.selfhosted
-
curl -L -o Dockerfile.selfhosted https://huggingface.co/spaces/jinksQspider/openWa/resolve/main/Dockerfile.selfhosted
2.45 kB
| # OpenWA - Dockerfile | |
| # Multi-stage build for production-ready image | |
| # ===== Stage 1: Builder ===== | |
| FROM docker.io/node:22-slim AS builder | |
| WORKDIR /app | |
| # Install build dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| python3 \ | |
| make \ | |
| g++ \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy package files | |
| COPY package*.json ./ | |
| # Install all dependencies (including devDependencies for build) | |
| RUN npm ci | |
| # Copy source code | |
| COPY . . | |
| # Build the application | |
| RUN npm run build | |
| # ===== Stage 2: Production ===== | |
| FROM docker.io/node:22-slim AS production | |
| # Install Chrome/Chromium and required dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| chromium \ | |
| fonts-liberation \ | |
| libappindicator3-1 \ | |
| libasound2 \ | |
| libatk-bridge2.0-0 \ | |
| libatk1.0-0 \ | |
| libcups2 \ | |
| libdbus-1-3 \ | |
| libdrm2 \ | |
| libgbm1 \ | |
| libgtk-3-0 \ | |
| libnspr4 \ | |
| libnss3 \ | |
| libx11-xcb1 \ | |
| libxcomposite1 \ | |
| libxdamage1 \ | |
| libxrandr2 \ | |
| xdg-utils \ | |
| dumb-init \ | |
| gosu \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set Chrome executable path for Puppeteer | |
| ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium | |
| ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true | |
| ENV PUPPETEER_ARGS=--no-sandbox,--disable-setuid-sandbox,--disable-dev-shm-usage,--disable-gpu,--no-zygote,--single-process,--disable-ipv6 | |
| # Create app user for security | |
| RUN groupadd -r openwa && useradd -r -g openwa openwa | |
| WORKDIR /app | |
| # Copy package files | |
| COPY package*.json ./ | |
| # Install production dependencies only | |
| RUN npm ci --omit=dev && npm cache clean --force | |
| # Copy built application from builder stage | |
| COPY --from=builder /app/dist ./dist | |
| # Create data directories with correct ownership | |
| RUN mkdir -p ./data/sessions ./data/media && \ | |
| chown -R openwa:openwa /app | |
| # Copy entrypoint: runs as root to fix named-volume ownership, then drops to openwa via gosu | |
| COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | |
| RUN chmod +x /usr/local/bin/docker-entrypoint.sh | |
| # Expose port | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ | |
| CMD curl -f http://localhost:2785/api/health || exit 1 | |
| # dumb-init is PID 1 and handles signal forwarding. | |
| # It execs docker-entrypoint.sh (as root), which fixes volume ownership and | |
| # then drops to the openwa user via gosu before starting the node process. | |
| ENTRYPOINT ["dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"] | |
| CMD ["node", "dist/main"] | |