Update Dockerfile
Browse files- Dockerfile +21 -25
Dockerfile
CHANGED
|
@@ -1,36 +1,32 @@
|
|
| 1 |
-
# Use the official image as base
|
| 2 |
FROM ghcr.io/flaresolverr/flaresolverr:latest
|
| 3 |
|
| 4 |
-
# 1. Set
|
| 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 |
-
#
|
| 12 |
-
#
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
# Create the standard Hugging Face user home directory
|
| 17 |
-
RUN mkdir -p /home/user/app
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
#
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
# Switch to
|
| 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.
|
|
|
|
|
|
|
| 1 |
FROM ghcr.io/flaresolverr/flaresolverr:latest
|
| 2 |
|
| 3 |
+
# 1. Set Hugging Face Port
|
| 4 |
ENV PORT=7860
|
|
|
|
| 5 |
ENV HOST=0.0.0.0
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
# 2. Critical: Set HOME to /tmp
|
| 8 |
+
# Chrome crashes if it can't write lockfiles to the user directory.
|
| 9 |
+
# /tmp is always writable in Docker.
|
| 10 |
+
ENV HOME=/tmp
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
# 3. Optimize for Hugging Face
|
| 13 |
+
# Disable the internal startup test to prevent timeouts (we know it works)
|
| 14 |
+
ENV TEST_URL=127.0.0.1
|
| 15 |
+
# Reduce logging noise unless there is an error
|
| 16 |
+
ENV LOG_LEVEL=info
|
| 17 |
+
# Force Chrome to use /tmp for its user data to avoid permission crashes
|
| 18 |
+
ENV CHROMIUM_ARGS="--user-data-dir=/tmp/chrome-data --no-sandbox --disable-dev-shm-usage"
|
| 19 |
|
| 20 |
+
# 4. Fix Permissions for User 1000 (Hugging Face Default)
|
| 21 |
+
USER root
|
| 22 |
+
RUN mkdir -p /tmp/chrome-data && \
|
| 23 |
+
chown -R 1000:1000 /tmp && \
|
| 24 |
+
chmod -R 777 /tmp && \
|
| 25 |
+
chown -R 1000:1000 /app && \
|
| 26 |
+
chmod -R 777 /app
|
| 27 |
|
| 28 |
+
# Switch back to the required Hugging Face user
|
| 29 |
USER 1000
|
| 30 |
|
| 31 |
# Expose the port
|
| 32 |
+
EXPOSE 7860
|
|
|
|
|
|
|
|
|