misukisu commited on
Commit
8df9d6a
·
verified ·
1 Parent(s): 1f6ed85

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -3
Dockerfile CHANGED
@@ -1,17 +1,35 @@
 
1
  FROM python:3.11-slim
2
 
3
  ENV PYTHONDONTWRITEBYTECODE=1 \
4
  PYTHONUNBUFFERED=1 \
5
- HF_HOME=/tmp/hf-cache
 
6
 
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
- libsndfile1 ffmpeg && rm -rf /var/lib/apt/lists/*
 
9
 
10
- RUN useradd --create-home --uid 1000 user
11
  WORKDIR /home/user/app
 
 
 
 
 
 
12
  COPY requirements.txt ./
 
13
  RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
14
  COPY --chown=user:user . .
 
15
  USER user
 
16
  EXPOSE 7860
 
17
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
1
+
2
  FROM python:3.11-slim
3
 
4
  ENV PYTHONDONTWRITEBYTECODE=1 \
5
  PYTHONUNBUFFERED=1 \
6
+ HF_HOME=/tmp/hf-cache \
7
+ OMP_NUM_THREADS=2
8
 
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ libsndfile1 ffmpeg libgomp1 \
11
+ && rm -rf /var/lib/apt/lists/*
12
 
 
13
  WORKDIR /home/user/app
14
+
15
+ # Install compatible CPU versions of PyTorch and TorchVision
16
+ RUN pip install --no-cache-dir \
17
+ --index-url https://download.pytorch.org/whl/cpu \
18
+ torch==2.9.0 torchvision==0.24.0
19
+
20
  COPY requirements.txt ./
21
+
22
  RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Verify TorchVision loads correctly
25
+ RUN python -c "import torch, torchvision; from torchvision.transforms.v2 import functional; print('Dependencies OK')"
26
+
27
+ RUN useradd --create-home --uid 1000 user
28
+
29
  COPY --chown=user:user . .
30
+
31
  USER user
32
+
33
  EXPOSE 7860
34
+
35
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]