File size: 926 Bytes
264a3ab
 
c39163c
264a3ab
 
 
c39163c
 
 
 
264a3ab
c39163c
 
 
 
 
 
 
264a3ab
c39163c
 
 
 
 
 
 
264a3ab
c39163c
264a3ab
 
 
c39163c
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
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