sixfingerdev commited on
Commit
f6a681e
·
verified ·
1 Parent(s): 95b2b3b

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +49 -0
Dockerfile ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ============================================
2
+ # SixFinger AI Backend - Hugging Face Spaces
3
+ # ============================================
4
+
5
+ FROM python:3.10-slim
6
+
7
+ # Metadata
8
+ LABEL maintainer="SixFinger Code"
9
+ LABEL description="Pollinations API Proxy for PythonAnywhere"
10
+
11
+ # Environment variables
12
+ ENV PYTHONUNBUFFERED=1 \
13
+ PYTHONDONTWRITEBYTECODE=1 \
14
+ PIP_NO_CACHE_DIR=1 \
15
+ PIP_DISABLE_PIP_VERSION_CHECK=1
16
+
17
+ # Set working directory
18
+ WORKDIR /app
19
+
20
+ # Install system dependencies (if needed)
21
+ RUN apt-get update && apt-get install -y --no-install-recommends \
22
+ curl \
23
+ && rm -rf /var/lib/apt/lists/*
24
+
25
+ # Copy requirements first (for better caching)
26
+ COPY requirements.txt .
27
+
28
+ # Install Python dependencies
29
+ RUN pip install --no-cache-dir -r requirements.txt
30
+
31
+ # Copy application code
32
+ COPY app.py .
33
+
34
+ # Create non-root user for security
35
+ RUN useradd -m -u 1000 appuser && \
36
+ chown -R appuser:appuser /app
37
+
38
+ # Switch to non-root user
39
+ USER appuser
40
+
41
+ # Expose port (HF Spaces uses 7860)
42
+ EXPOSE 7860
43
+
44
+ # Health check
45
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
46
+ CMD curl -f http://localhost:7860/health || exit 1
47
+
48
+ # Start command
49
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]