trinitytf commited on
Commit
9aa98fa
·
verified ·
1 Parent(s): 5f9a8c8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -8
Dockerfile CHANGED
@@ -1,19 +1,36 @@
1
- # Use the official FlareSolverr image
2
  FROM ghcr.io/flaresolverr/flaresolverr:latest
3
 
4
- # Set the port to 7860 (Required by Hugging Face Spaces)
5
  ENV PORT=7860
6
- # Disable the "Test" URL on startup to speed up boot time
 
 
7
  ENV TEST_URL=http://localhost:7860
8
 
9
- # Hugging Face runs as user 1000 by default.
10
- # We need to ensure permissions are correct for the new port/logs.
 
11
  USER root
12
- RUN mkdir -p /app && chown -R 1000:1000 /app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  USER 1000
14
 
15
  # Expose the port
16
  EXPOSE 7860
17
 
18
- # Command is already set in the base image,
19
- # but the ENV PORT=7860 above ensures it listens correctly.
 
1
+ # Use the official image as base
2
  FROM ghcr.io/flaresolverr/flaresolverr:latest
3
 
4
+ # 1. Set the Port to 7860 (Required by Hugging Face)
5
  ENV PORT=7860
6
+ # 2. Host must be 0.0.0.0 to be accessible outside the container
7
+ ENV HOST=0.0.0.0
8
+ # 3. Disable the "Test" URL to prevent boot crashes if it fails
9
  ENV TEST_URL=http://localhost:7860
10
 
11
+ # --- PERMISSION FIX ---
12
+ # Hugging Face runs as User 1000. We must ensure that user
13
+ # has permissions to write to the app directory and the home folder.
14
  USER root
15
+
16
+ # Create the standard Hugging Face user home directory
17
+ RUN mkdir -p /home/user/app
18
+
19
+ # Copy the current application files to the new home (if any) and fix permissions
20
+ # We make the entire /app directory writable by User 1000
21
+ RUN chown -R 1000:1000 /app && \
22
+ chmod -R 777 /app && \
23
+ chown -R 1000:1000 /home/user && \
24
+ chmod -R 777 /home/user
25
+
26
+ # Set the Home directory explicitly
27
+ ENV HOME=/home/user
28
+
29
+ # Switch to User 1000 (The Hugging Face default)
30
  USER 1000
31
 
32
  # Expose the port
33
  EXPOSE 7860
34
 
35
+ # The base image already has the correct command to start,
36
+ # so we don't need to overwrite CMD.