Adoley commited on
Commit
e55cbc6
·
1 Parent(s): c1d39a0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -11
Dockerfile CHANGED
@@ -1,19 +1,26 @@
1
- # Use the official Python image as the base image
2
- FROM python:3.9
3
 
4
- # Set the working directory in the container
5
- WORKDIR /code
6
 
7
- # Copy requirements.txt file
8
- COPY requirements.txt .
9
 
10
- # Install the Python dependencies
11
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
 
12
 
13
- # copy all the files in the app folder
14
- COPY app/ .
15
 
 
 
 
 
16
  EXPOSE 7860
17
 
18
- # Start the FastAPI app with Uvicorn when the container starts
19
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ # Set working directory
2
+ WORKDIR /app
3
 
4
+ # Create a writable directory for the cache
5
+ RUN mkdir -p /.cache/huggingface/hub && chmod -R 777 /.cache
6
 
7
+ # Set the TRANSFORMERS_CACHE environment variable
8
+ ENV TRANSFORMERS_CACHE /.cache/huggingface/hub
9
 
10
+ # Copy the API files to the container
11
+ COPY main.py .
12
+ COPY gbc.pkl .
13
+ COPY scaler.pkl .
14
 
15
+ # Upgrade pip
16
+ RUN /usr/local/bin/python -m pip install --upgrade pip
17
 
18
+ # Install dependencies
19
+ RUN pip install --no-cache-dir fastapi pydantic uvicorn scikit-learn joblib pandas numpy
20
+
21
+ # Expose the API port
22
  EXPOSE 7860
23
 
24
+ # Start the API
25
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
26
+ #CMD ["uvicorn", "main:app", "--host", "127.0.0.1", "--port", "8000"]