kouki321 commited on
Commit
4eefb34
·
verified ·
1 Parent(s): 39af176

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -10
Dockerfile CHANGED
@@ -1,8 +1,7 @@
1
- # Use a slim base image
2
  FROM python:3.10-slim
3
 
4
- # Install system dependencies
5
- RUN apt-get update && \
6
  apt-get install -y git && \
7
  rm -rf /var/lib/apt/lists/*
8
 
@@ -10,19 +9,22 @@ RUN apt-get update && \
10
  COPY requirements.txt /app/requirements.txt
11
  RUN pip install --no-cache-dir -r /app/requirements.txt
12
 
13
- # Create and set working directory
14
  WORKDIR /app
15
  COPY app.py /app/app.py
16
 
17
- # Create a writable cache directory
18
- RUN mkdir -p /app/cache
 
19
 
20
- # Override default cache paths
21
- ENV TRANSFORMERS_CACHE=/app/cache
22
  ENV HF_HOME=/app/cache
 
 
 
23
 
24
- # Expose port for your UI
25
  EXPOSE 7860
26
 
27
- # Run the application
28
  CMD ["python", "app.py"]
 
1
+ # Base image
2
  FROM python:3.10-slim
3
 
4
+ # Install system dependencies\ nRUN apt-get update && \
 
5
  apt-get install -y git && \
6
  rm -rf /var/lib/apt/lists/*
7
 
 
9
  COPY requirements.txt /app/requirements.txt
10
  RUN pip install --no-cache-dir -r /app/requirements.txt
11
 
12
+ # Set working directory
13
  WORKDIR /app
14
  COPY app.py /app/app.py
15
 
16
+ # Create and permit cache directory
17
+ RUN mkdir -p /app/cache && \
18
+ chmod -R a+rwx /app/cache
19
 
20
+ # Override cache paths
 
21
  ENV HF_HOME=/app/cache
22
+ ENV HF_DATASETS_CACHE=/app/cache
23
+ # Transformer's own cache var is deprecated but safe to set
24
+ ENV TRANSFORMERS_CACHE=/app/cache
25
 
26
+ # Expose port (Gradio/Streamlit default)
27
  EXPOSE 7860
28
 
29
+ # Launch
30
  CMD ["python", "app.py"]