Chanlefe commited on
Commit
668d1a9
·
verified ·
1 Parent(s): db787a9

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +46 -0
Dockerfile ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ libgl1-mesa-glx \
9
+ libglib2.0-0 \
10
+ libsm6 \
11
+ libxext6 \
12
+ libxrender-dev \
13
+ libgomp1 \
14
+ libgstreamer1.0-0 \
15
+ libgstreamer-plugins-base1.0-0 \
16
+ wget \
17
+ curl \
18
+ git \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ # Copy requirements and install Python dependencies
22
+ COPY requirements.txt .
23
+ RUN pip install --no-cache-dir --upgrade pip
24
+ RUN pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Copy application code
27
+ COPY . .
28
+
29
+ # Create directory for model storage
30
+ RUN mkdir -p /app/fine_tuned_bert_sentiment
31
+
32
+ # Set environment variables
33
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
34
+ ENV GRADIO_SERVER_PORT="7860"
35
+ ENV TRANSFORMERS_CACHE="/app/cache"
36
+ ENV HF_HOME="/app/cache"
37
+
38
+ # Expose port
39
+ EXPOSE 7860
40
+
41
+ # Health check
42
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
43
+ CMD curl -f http://localhost:7860/health || exit 1
44
+
45
+ # Run the application
46
+ CMD ["python", "app.py"]