jatinmehra commited on
Commit
edab8ad
·
1 Parent(s): 2709244

add Dockerfile for NegaBot API setup with Python 3.12 and necessary dependencies

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.12 slim image
2
+ FROM python:3.12-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ gcc \
10
+ g++ \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements file first for better build caching
14
+ COPY requirements.txt .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy application code
20
+ COPY . .
21
+
22
+ # Create writable directory for database and cache
23
+ RUN mkdir -p /app/data /app/.cache && chmod -R 777 /app/data /app/.cache
24
+
25
+ # Set environment variables for Hugging Face cache
26
+ ENV TRANSFORMERS_CACHE=/app/.cache
27
+ ENV HF_HOME=/app/.cache
28
+ ENV PYTHONPATH=/app
29
+ ENV PYTHONUNBUFFERED=1
30
+
31
+ # Expose API port
32
+ EXPOSE 7860
33
+
34
+ CMD ["python", "api.py"]