AnuragShirke commited on
Commit
0afbe1a
·
1 Parent(s): 43acc9c

fix: Set HF_HOME and pre-create cache directory

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -4
Dockerfile CHANGED
@@ -53,8 +53,8 @@ COPY --chown=appuser:appgroup ./alembic.ini /app/alembic.ini
53
  # Grant ownership of home directory to appuser
54
  RUN chown -R appuser:appgroup /home/appuser
55
 
56
- # Create data and uploads directories and set permissions
57
- RUN mkdir -p /app/data /app/uploads && chown -R appuser:appgroup /app/data /app/uploads
58
 
59
  # Make scripts executable
60
  RUN chmod +x /app/scripts/*.sh
@@ -62,10 +62,10 @@ RUN chmod +x /app/scripts/*.sh
62
  # Switch to non-root user
63
  USER appuser
64
 
65
- # Ensure user's local bin is in PATH, set PYTHONPATH, and configure a writable cache for transformers
66
  ENV PATH="/home/appuser/.local/bin:${PATH}"
67
  ENV PYTHONPATH="/home/appuser/.local/lib/python3.11/site-packages"
68
- ENV TRANSFORMERS_CACHE="/home/appuser/.cache"
69
 
70
  # Expose port 8000
71
  EXPOSE 8000
 
53
  # Grant ownership of home directory to appuser
54
  RUN chown -R appuser:appgroup /home/appuser
55
 
56
+ # Create data, uploads, and cache directories and set permissions
57
+ RUN mkdir -p /app/data /app/uploads /home/appuser/.cache && chown -R appuser:appgroup /app/data /app/uploads /home/appuser/.cache
58
 
59
  # Make scripts executable
60
  RUN chmod +x /app/scripts/*.sh
 
62
  # Switch to non-root user
63
  USER appuser
64
 
65
+ # Ensure user's local bin is in PATH, set PYTHONPATH, and configure the Hugging Face cache home
66
  ENV PATH="/home/appuser/.local/bin:${PATH}"
67
  ENV PYTHONPATH="/home/appuser/.local/lib/python3.11/site-packages"
68
+ ENV HF_HOME="/home/appuser/.cache"
69
 
70
  # Expose port 8000
71
  EXPOSE 8000