zhimin-z commited on
Commit
68ab628
·
1 Parent(s): 5479427
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use official Python runtime as base image
2
+ FROM python:3.12-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies (if needed)
8
+ RUN apt-get update && apt-get install -y \
9
+ git \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements.txt
13
+ COPY requirements.txt .
14
+
15
+ # Install Python dependencies
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Copy application files
19
+ COPY .env .
20
+ COPY msr.py .
21
+
22
+ # Create a non-root user for security (optional but recommended)
23
+ RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
24
+ USER appuser
25
+
26
+ # Expose port for Gradio web interface (default is 7860)
27
+ EXPOSE 7860
28
+
29
+ # Set environment variables
30
+ ENV GRADIO_SERVER_NAME=0.0.0.0
31
+ ENV GRADIO_SERVER_PORT=7860
32
+
33
+ # Run the Gradio app
34
+ CMD ["python", "msr.py"]