tscr-369 commited on
Commit
e417eb4
·
verified ·
1 Parent(s): 4747308

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -2
Dockerfile CHANGED
@@ -1,9 +1,11 @@
1
  FROM python:3.10-slim
2
 
 
3
  RUN apt-get update && apt-get install -y git
4
 
5
  WORKDIR /app
6
 
 
7
  COPY requirements.txt .
8
  RUN pip install --upgrade pip && pip install -r requirements.txt
9
 
@@ -12,16 +14,19 @@ RUN git clone https://github.com/earthspecies/NatureLM-audio.git
12
  RUN sed -i '/beans-zero/d' NatureLM-audio/pyproject.toml
13
  RUN pip install -e NatureLM-audio
14
 
15
- # Set cache envs to writable location
16
  ENV HF_HOME=/app/.cache/huggingface
17
  ENV TRANSFORMERS_CACHE=/app/.cache/transformers
18
  ENV TORCH_HOME=/app/.cache/torch
19
  ENV XDG_CACHE_HOME=/app/.cache
 
 
 
20
  RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
21
 
 
22
  COPY main.py .
23
 
24
  EXPOSE 7860
25
 
26
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
27
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Install system dependencies
4
  RUN apt-get update && apt-get install -y git
5
 
6
  WORKDIR /app
7
 
8
+ # Copy requirements and install
9
  COPY requirements.txt .
10
  RUN pip install --upgrade pip && pip install -r requirements.txt
11
 
 
14
  RUN sed -i '/beans-zero/d' NatureLM-audio/pyproject.toml
15
  RUN pip install -e NatureLM-audio
16
 
17
+ # Set HuggingFace and Torch cache to a writable directory
18
  ENV HF_HOME=/app/.cache/huggingface
19
  ENV TRANSFORMERS_CACHE=/app/.cache/transformers
20
  ENV TORCH_HOME=/app/.cache/torch
21
  ENV XDG_CACHE_HOME=/app/.cache
22
+
23
+ # Set HuggingFace token for gated model access (injected from Space secret)
24
+ ENV HF_TOKEN=${HF_TOKEN}
25
  RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
26
 
27
+ # Copy your FastAPI app
28
  COPY main.py .
29
 
30
  EXPOSE 7860
31
 
 
32
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]