iimran commited on
Commit
109d04c
·
verified ·
1 Parent(s): 2a00ccd

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -0
Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.10-slim
3
+
4
+ # Set environment variable for cache directory
5
+ ENV HF_HOME=/app/.cache
6
+ #ENV TRANSFORMERS_CACHE=/app/.cache
7
+
8
+
9
+ # Set the working directory to /app
10
+ WORKDIR /app
11
+
12
+ # Copy the requirements.txt file into the container at /app
13
+ COPY requirements.txt .
14
+
15
+ # Install any needed packages specified in requirements.txt
16
+ RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Copy the rest of the application code into the container at /app, including the .cache folder
19
+ COPY . /app
20
+
21
+ # Ensure the .cache folder is writable
22
+ RUN chmod -R 777 /app/.cache
23
+ RUN chmod 777 api_logs.jsonl
24
+
25
+ # Expose port 7860 for the app
26
+ EXPOSE 7860
27
+
28
+ # Run the FastAPI app with uvicorn
29
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]