esfandtv / Dockerfile
trinitytf's picture
Update Dockerfile
9aa98fa verified
# Use the official image as base
FROM ghcr.io/flaresolverr/flaresolverr:latest
# 1. Set the Port to 7860 (Required by Hugging Face)
ENV PORT=7860
# 2. Host must be 0.0.0.0 to be accessible outside the container
ENV HOST=0.0.0.0
# 3. Disable the "Test" URL to prevent boot crashes if it fails
ENV TEST_URL=http://localhost:7860
# --- PERMISSION FIX ---
# Hugging Face runs as User 1000. We must ensure that user
# has permissions to write to the app directory and the home folder.
USER root
# Create the standard Hugging Face user home directory
RUN mkdir -p /home/user/app
# Copy the current application files to the new home (if any) and fix permissions
# We make the entire /app directory writable by User 1000
RUN chown -R 1000:1000 /app && \
chmod -R 777 /app && \
chown -R 1000:1000 /home/user && \
chmod -R 777 /home/user
# Set the Home directory explicitly
ENV HOME=/home/user
# Switch to User 1000 (The Hugging Face default)
USER 1000
# Expose the port
EXPOSE 7860
# The base image already has the correct command to start,
# so we don't need to overwrite CMD.