Bikas0 commited on
Commit
190d059
1 Parent(s): 4c5156b

docker update

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -14
Dockerfile CHANGED
@@ -1,27 +1,38 @@
1
- # Use the official Python image as a base image
2
- FROM python:3.10.0-slim-buster
3
 
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE 1
6
- ENV PYTHONUNBUFFERED 1
7
 
8
  # Set the working directory in the container
9
  WORKDIR /app
10
 
11
- # Copy the dependencies file to the working directory
12
- COPY requirements.txt .
 
 
 
 
 
 
 
 
 
13
 
14
- # Install any dependencies
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
- # Copy the content of the local src directory to the working directory
18
- COPY . .
 
 
 
 
 
 
 
 
19
 
20
  # Make port 7860 available to the world outside this container
21
  EXPOSE 7860
22
 
23
- # Define environment variable (corrected the syntax for environment variable name and value)
24
- # ENV FLASK_APP=app.py
25
-
26
  # Command to run the application
27
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
 
 
 
1
 
2
+ # Use the official Python image from the Docker Hub
3
+ FROM python:3.10.0-slim-buster
 
4
 
5
  # Set the working directory in the container
6
  WORKDIR /app
7
 
8
+ # Copy the current directory contents into the container at /app
9
+ COPY . /app
10
+
11
+ # Upgrade pip to the latest version
12
+ RUN pip install --upgrade pip
13
+
14
+ # Install build essentials and gfortran
15
+ RUN apt-get update && apt-get install -y \
16
+ build-essential \
17
+ gfortran \
18
+ && rm -rf /var/lib/apt/lists/*
19
 
20
+ # Install any needed packages specified in requirements.txt
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+
24
+ # Set environment variables bikas
25
+
26
+ ENV HF_HOME=/app/.huggingface_cache
27
+ ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
28
+
29
+ # Change ownership of directories to the non-root user
30
+ RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
31
+ # # Switch to a non-root user
32
+ # USER nobody
33
 
34
  # Make port 7860 available to the world outside this container
35
  EXPOSE 7860
36
 
 
 
 
37
  # Command to run the application
38
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]