Jobsforce commited on
Commit
02169dd
·
verified ·
1 Parent(s): 5d1ac21

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -5
Dockerfile CHANGED
@@ -1,8 +1,17 @@
 
1
  FROM python:3.10-slim
 
 
2
  ENV PYTHONDONTWRITEBYTECODE=1
3
  ENV PYTHONUNBUFFERED=1
4
- ENV NLTK_DATA=/app/nltk_data
 
 
 
5
  WORKDIR /app
 
 
 
6
  RUN apt-get update && apt-get install -y \
7
  gcc \
8
  libglib2.0-0 \
@@ -10,13 +19,17 @@ RUN apt-get update && apt-get install -y \
10
  libxext6 \
11
  libxrender-dev \
12
  && rm -rf /var/lib/apt/lists/*
 
 
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
- RUN mkdir -p /app/nltk_data && \
16
- python -m nltk.downloader -d /app/nltk_data punkt
17
 
 
18
  COPY . .
19
 
20
- EXPOSE 5000
 
21
 
22
- CMD ["python", "app.py"]
 
 
1
+ # Use an official Python base image
2
  FROM python:3.10-slim
3
+
4
+ # Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
+ ENV TRANSFORMERS_CACHE=/app/cache
8
+ ENV HF_HOME=/app/cache
9
+
10
+ # Create app directory and set proper permissions
11
  WORKDIR /app
12
+ RUN mkdir -p /app/cache && chmod -R 777 /app/cache
13
+
14
+ # Install system dependencies
15
  RUN apt-get update && apt-get install -y \
16
  gcc \
17
  libglib2.0-0 \
 
19
  libxext6 \
20
  libxrender-dev \
21
  && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Copy and install Python dependencies
24
  COPY requirements.txt .
25
  RUN pip install --no-cache-dir -r requirements.txt
26
+ RUN python -m nltk.downloader punkt
 
27
 
28
+ # Copy application code
29
  COPY . .
30
 
31
+ # Set permissions for the app directory
32
+ RUN chmod -R 777 /app
33
 
34
+ EXPOSE 5000
35
+ CMD ["python", "app.py"]