| FROM ghcr.io/flaresolverr/flaresolverr:latest | |
| # 1. Set Hugging Face Port | |
| ENV PORT=7860 | |
| ENV HOST=0.0.0.0 | |
| # 2. Critical: Set HOME to /tmp | |
| # Chrome crashes if it can't write lockfiles to the user directory. | |
| # /tmp is always writable in Docker. | |
| ENV HOME=/tmp | |
| # 3. Optimize for Hugging Face | |
| # Disable the internal startup test to prevent timeouts (we know it works) | |
| ENV TEST_URL=127.0.0.1 | |
| # Reduce logging noise unless there is an error | |
| ENV LOG_LEVEL=info | |
| # Force Chrome to use /tmp for its user data to avoid permission crashes | |
| ENV CHROMIUM_ARGS="--user-data-dir=/tmp/chrome-data --no-sandbox --disable-dev-shm-usage" | |
| # 4. Fix Permissions for User 1000 (Hugging Face Default) | |
| USER root | |
| RUN mkdir -p /tmp/chrome-data && \ | |
| chown -R 1000:1000 /tmp && \ | |
| chmod -R 777 /tmp && \ | |
| chown -R 1000:1000 /app && \ | |
| chmod -R 777 /app | |
| # Switch back to the required Hugging Face user | |
| USER 1000 | |
| # Expose the port | |
| EXPOSE 7860 |