ezequiellopez commited on
Commit
07f753d
·
1 Parent(s): e145e85

fixing HF_HOME bug

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -8
Dockerfile CHANGED
@@ -1,14 +1,40 @@
1
- # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
 
4
- FROM python:3.9
5
 
6
- WORKDIR /code
 
 
7
 
8
- COPY ./requirements.txt /code/requirements.txt
 
 
 
9
 
10
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
 
 
 
 
 
 
 
 
11
 
12
- COPY . .
 
13
 
14
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile
2
+ FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
3
 
4
+ COPY ./app /app
5
 
6
+ RUN pip install -r /app/requirements.txt
7
+ # Use the official Python image
8
+ FROM python:3.9-slim
9
 
10
+ # Set environment variables
11
+ ENV PYTHONDONTWRITEBYTECODE 1
12
+ ENV PYTHONUNBUFFERED 1
13
+ ENV HF_HOME /app/cache
14
 
15
+ # Install system dependencies
16
+ RUN apt-get update \
17
+ && apt-get install -y --no-install-recommends \
18
+ gcc \
19
+ libpq-dev \
20
+ libhdf5-dev \
21
+ libc6 \
22
+ libgomp1 \
23
+ redis \
24
+ && rm -rf /var/lib/apt/lists/*
25
 
26
+ # Set the working directory in the container
27
+ WORKDIR /app
28
 
29
+ # Install Python dependencies
30
+ COPY ./app/requirements.txt /app/requirements.txt
31
+ RUN pip install --upgrade pip && pip install -r requirements.txt
32
+
33
+ # Copy the FastAPI application code into the container
34
+ COPY ./app /app
35
+
36
+ # Expose port 8000 to the outside world
37
+ EXPOSE 7860
38
+
39
+ # Command to run the FastAPI application
40
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]