Huzaifa367 commited on
Commit
7e5d28c
·
verified ·
1 Parent(s): 36ee7c6

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python image as a base
2
+ FROM python:3.9-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE 1
6
+ ENV PYTHONUNBUFFERED 1
7
+
8
+ # Install system dependencies
9
+ RUN apt-get update \
10
+ && apt-get install -y --no-install-recommends \
11
+ wget \
12
+ unzip \
13
+ && apt-get clean \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Set up a working directory
17
+ WORKDIR /app
18
+
19
+ # Copy and install Python dependencies
20
+ COPY requirements.txt .
21
+ RUN pip install --upgrade pip \
22
+ && pip install -r requirements.txt
23
+
24
+ # Install Jinja2
25
+ RUN pip install jinja2
26
+
27
+ # Set the TRANSFORMERS_CACHE environment variable
28
+ ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface
29
+
30
+ # Create the cache folder with appropriate permissions
31
+ RUN mkdir -p $TRANSFORMERS_CACHE && chmod -R 777 $TRANSFORMERS_CACHE
32
+
33
+ # Copy the FastAPI app into the container
34
+ COPY app.py .
35
+
36
+ EXPOSE 8000
37
+
38
+ # Command to run the FastAPI application using uvicorn
39
+ CMD uvicorn app:app --host 127.0.0.1 --port 8000