Jobsforce commited on
Commit
da3185c
·
verified ·
1 Parent(s): 9fde7ed

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -26
Dockerfile CHANGED
@@ -1,42 +1,20 @@
1
  FROM python:3.10-slim
2
 
3
- # Set environment variables
4
  ENV PYTHONDONTWRITEBYTECODE=1
5
  ENV PYTHONUNBUFFERED=1
6
  ENV HF_HOME=/app/hf_cache
7
  ENV NLTK_DATA=/app/nltk_data
8
  ENV PORT=8080
9
- CMD ["gunicorn", "app:app"]
10
 
11
- # Set working directory
12
  WORKDIR /app
13
 
14
- # Install system dependencies
15
- RUN apt-get update && apt-get install -y \
16
- gcc \
17
- python3-dev \
18
- curl \
19
- && rm -rf /var/lib/apt/lists/*
20
-
21
- # Create necessary directories with appropriate permissions
22
- RUN mkdir -p /app/hf_cache /app/nltk_data && \
23
- chmod -R 777 /app/hf_cache /app/nltk_data
24
 
25
- # Copy requirements and install Python dependencies
26
  COPY requirements.txt .
27
- RUN pip install --no-cache-dir -r requirements.txt && \
28
- python -c "import nltk; nltk.download('punkt', download_dir='/app/nltk_data')" && \
29
- python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; \
30
- AutoTokenizer.from_pretrained('priyabrat/AI.or.Human.text.classification', cache_dir='/app/hf_cache'); \
31
- AutoModelForSequenceClassification.from_pretrained('priyabrat/AI.or.Human.text.classification', cache_dir='/app/hf_cache')"
32
 
33
- # Copy application code
34
  COPY . .
35
 
36
- # Create a non-root user and switch to it
37
- RUN adduser --disabled-password --gecos '' appuser && \
38
- chown -R appuser:appuser /app
39
- USER appuser
40
 
41
- # Expose port and define default command
42
- EXPOSE 8080
 
1
  FROM python:3.10-slim
2
 
 
3
  ENV PYTHONDONTWRITEBYTECODE=1
4
  ENV PYTHONUNBUFFERED=1
5
  ENV HF_HOME=/app/hf_cache
6
  ENV NLTK_DATA=/app/nltk_data
7
  ENV PORT=8080
 
8
 
 
9
  WORKDIR /app
10
 
11
+ RUN apt-get update && apt-get install -y gcc curl && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
12
 
 
13
  COPY requirements.txt .
14
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
15
 
 
16
  COPY . .
17
 
18
+ EXPOSE 8080
 
 
 
19
 
20
+ CMD ["gunicorn", "app:app"]