LovnishVerma commited on
Commit
71bcb0e
·
verified ·
1 Parent(s): eb20dff

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -10
Dockerfile CHANGED
@@ -38,21 +38,20 @@ COPY requirements.txt /app/
38
  RUN pip install --no-cache-dir -U pip && \
39
  pip install --no-cache-dir -r requirements.txt
40
 
41
- # Create a non-root user 'user' with UID 1000 (standard for Hugging Face Spaces)
42
- # This prevents permission issues when Hugging Face runs the container as UID 1000
43
- RUN useradd -m -u 1000 user && \
44
- mkdir -p /app/database /app/logs /app/exports && \
45
- chown -R user:user /app
46
 
47
- # Ensure that the Playwright browser files are fully readable/executable by our non-root user.
48
  # In the official Playwright image, browsers are stored in /ms-playwright.
49
  RUN chmod -R 755 /ms-playwright
50
 
51
- # Copy the rest of the application files to the container and set ownership to 'user'
52
- COPY --chown=user:user . /app
53
 
54
- # Switch to the non-root user
55
- USER user
56
 
57
  # Expose the default port expected by Hugging Face Spaces (7860)
58
  EXPOSE 7860
 
38
  RUN pip install --no-cache-dir -U pip && \
39
  pip install --no-cache-dir -r requirements.txt
40
 
41
+ # Leverage the pre-created 'pwuser' user (UID 1000) already defined in the official Playwright image
42
+ # This prevents UID collision errors during useradd and complies with HF Spaces UID 1000 requirement.
43
+ RUN mkdir -p /app/database /app/logs /app/exports && \
44
+ chown -R 1000:1000 /app
 
45
 
46
+ # Ensure that the Playwright browser files are fully readable/executable by the non-root user.
47
  # In the official Playwright image, browsers are stored in /ms-playwright.
48
  RUN chmod -R 755 /ms-playwright
49
 
50
+ # Copy the rest of the application files to the container and set ownership to UID 1000 (pwuser)
51
+ COPY --chown=1000:1000 . /app
52
 
53
+ # Switch to the non-root user (UID 1000)
54
+ USER 1000
55
 
56
  # Expose the default port expected by Hugging Face Spaces (7860)
57
  EXPOSE 7860