Huzaifa367 commited on
Commit
2d5cfed
·
verified ·
1 Parent(s): 7e5d28c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -39
Dockerfile CHANGED
@@ -1,39 +1,30 @@
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
 
1
+ # Use the official Python image as the base image
2
+ FROM python:3.9-slim
3
+
4
+ # Set environment variables for Python
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
+ # Install necessary Python packages
17
+ RUN pip install --upgrade pip
18
+ RUN pip install gradio transformers huggingface_hub
19
+
20
+ # Set working directory in the container
21
+ WORKDIR /app
22
+
23
+ # Copy the Python script and model files into the container
24
+ COPY app.py /app/
25
+
26
+ # Expose port 7860 (default port for Gradio interface)
27
+ EXPOSE 7860
28
+
29
+ # Command to run the Python script with uvicorn when the container starts
30
+ CMD ["python", "app.py"]