jacob-valdez commited on
Commit
2faaffe
·
verified ·
1 Parent(s): 3a0eb51

Upload huggingface_pipeline/deployment/Dockerfile with huggingface_hub

Browse files
huggingface_pipeline/deployment/Dockerfile ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile for BuilderBrain inference API
2
+ FROM python:3.11-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONUNBUFFERED=1
6
+ ENV PYTHONDONTWRITEBYTECODE=1
7
+
8
+ # Install system dependencies
9
+ RUN apt-get update && apt-get install -y \
10
+ build-essential \
11
+ curl \
12
+ git \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Install uv package manager
16
+ RUN pip install uv
17
+
18
+ # Create non-root user
19
+ RUN useradd -m -u 1000 builderbrain
20
+
21
+ # Set work directory
22
+ WORKDIR /app
23
+
24
+ # Copy dependency files
25
+ COPY pyproject.toml uv.lock ./
26
+
27
+ # Set environment variables for runtime
28
+ ENV PYTHONUNBUFFERED=1
29
+ ENV PYTHONDONTWRITEBYTECODE=1
30
+
31
+ # Copy application code
32
+ COPY . ./
33
+
34
+ # Clean up any existing virtual environment with wrong permissions
35
+ RUN rm -rf .venv || true
36
+
37
+ # Expose port
38
+ EXPOSE 8000
39
+
40
+ # Health check
41
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
42
+ CMD curl -f http://localhost:8000/health || exit 1
43
+
44
+ # Start the application as root (needed for uv to create virtual environment)
45
+ CMD ["uv", "run", "uvicorn", "huggingface_pipeline.inference_api.app:app", "--host", "0.0.0.0", "--port", "8000"]