Adoley commited on
Commit
72dfa40
1 Parent(s): 658b30d

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -0
Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image
2
+ FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Create a writable directory for the cache
8
+ RUN mkdir -p /.cache/huggingface/hub && chmod -R 777 /.cache
9
+
10
+ # Set the TRANSFORMERS_CACHE environment variable
11
+ ENV TRANSFORMERS_CACHE /.cache/huggingface/hub
12
+
13
+ # Copy the API files to the container
14
+ COPY main.py .
15
+ COPY gbc.pkl .
16
+ COPY scaler.pkl .
17
+
18
+ # Upgrade pip
19
+ RUN /usr/local/bin/python -m pip install --upgrade pip
20
+
21
+ # Install dependencies
22
+ RUN pip install --no-cache-dir fastapi pydantic uvicorn scikit-learn joblib pandas numpy
23
+
24
+ # Expose the API port
25
+ EXPOSE 7860
26
+
27
+ # Start the API
28
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
29
+ #CMD ["uvicorn", "main:app", "--host", "127.0.0.1", "--port", "8000"]