codeby-hp commited on
Commit
3e69b29
·
verified ·
1 Parent(s): 28a0fff

modify dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -41
Dockerfile CHANGED
@@ -1,41 +1,39 @@
1
- # Use Python 3.10 slim image for smaller size
2
- FROM python:3.10-slim
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y \
9
- build-essential \
10
- curl \
11
- software-properties-common \
12
- git \
13
- && rm -rf /var/lib/apt/lists/*
14
-
15
- # Copy requirements first for better layer caching
16
- COPY requirements.txt .
17
-
18
- # Install Python dependencies
19
- RUN pip install --no-cache-dir -r requirements.txt
20
-
21
- # Download NLTK data
22
- RUN python -c "import nltk; nltk.download('stopwords'); nltk.download('wordnet'); nltk.download('omw-1.4')"
23
-
24
- # Copy application files
25
- COPY app.py .
26
- COPY templates/ templates/
27
- COPY models/ models/
28
-
29
- # Expose port 7860 (Hugging Face Spaces default)
30
- EXPOSE 7860
31
-
32
- # Set environment variables
33
- ENV PYTHONUNBUFFERED=1
34
- ENV PORT=7860
35
-
36
- # Health check
37
- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
38
- CMD curl -f http://localhost:7860/health || exit 1
39
-
40
- # Run the application
41
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use Python 3.10 slim image for smaller size
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ curl \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements first for better layer caching
14
+ COPY requirements.txt .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Download NLTK data
20
+ RUN python -c "import nltk; nltk.download('stopwords'); nltk.download('wordnet'); nltk.download('omw-1.4')"
21
+
22
+ # Copy application files
23
+ COPY app.py .
24
+ COPY templates/ templates/
25
+ COPY models/ models/
26
+
27
+ # Expose port 7860 (Hugging Face Spaces default)
28
+ EXPOSE 7860
29
+
30
+ # Set environment variables
31
+ ENV PYTHONUNBUFFERED=1
32
+ ENV PORT=7860
33
+
34
+ # Health check
35
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
36
+ CMD curl -f http://localhost:7860/health || exit 1
37
+
38
+ # Run the application
39
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]