cjell commited on
Commit
811bfb8
·
1 Parent(s): f86886b
Files changed (2) hide show
  1. Dockerfile +13 -3
  2. requirements.txt +5 -3
Dockerfile CHANGED
@@ -1,13 +1,23 @@
1
- FROM python:3.10
 
 
 
2
 
3
  WORKDIR /code
4
 
5
- COPY requirements.txt .
 
 
6
 
 
 
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
9
  COPY . .
10
 
11
- CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
12
 
 
 
13
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ ENV PYTHONUNBUFFERED=1
4
+ ENV HF_HOME=/tmp
5
 
6
  WORKDIR /code
7
 
8
+ RUN apt-get update && apt-get install -y \
9
+ curl \
10
+ && rm -rf /var/lib/apt/lists/*
11
 
12
+ COPY requirements.txt .
13
+ RUN pip install --no-cache-dir --upgrade pip
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
  COPY . .
17
 
18
+ EXPOSE 7860
19
 
20
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
21
+ CMD curl -f http://localhost:7860/ || exit 1
22
 
23
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]
requirements.txt CHANGED
@@ -1,5 +1,7 @@
1
  fastapi
2
- uvicorn
3
  transformers
4
- torch
5
- pydantic
 
 
 
1
  fastapi
2
+ uvicorn[standard]
3
  transformers
4
+ torch --index-url https://download.pytorch.org/whl/cpu
5
+ pydantic>=2.0
6
+ huggingface_hub
7
+ requests