joysthadd commited on
Commit
042f41e
·
verified ·
1 Parent(s): f4bb752

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +56 -0
Dockerfile ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim-bookworm
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1 \
4
+ PYTHONUNBUFFERED=1 \
5
+ UV_HTTP_TIMEOUT=120 \
6
+ UV_HTTP_MAX_RETRIES=5 \
7
+ HF_HOME=/tmp/hf_cache \
8
+ TRANSFORMERS_CACHE=/tmp/hf_cache
9
+
10
+ # Create a non-root user
11
+ RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser
12
+
13
+ WORKDIR /app
14
+
15
+ # Install git + ssh utilities
16
+ RUN apt-get update && apt-get install -y \
17
+ curl \
18
+ git \
19
+ openssh-client \
20
+ netcat-openbsd \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
24
+
25
+ COPY requirements.txt .
26
+
27
+ RUN uv pip install --system --upgrade pip setuptools wheel
28
+ RUN uv pip install --system torch==2.8.0+cpu --index-url https://download.pytorch.org/whl/cpu
29
+
30
+ # Install other requirements
31
+ RUN uv pip install --system -r requirements.txt
32
+
33
+ # ========== PRIVATE GIT CLONE BLOCK ==========
34
+ # ARG must match the HF secret name
35
+ ARG GIT_PRIVATE_KEY
36
+
37
+ # Configure SSH for GitHub
38
+ RUN mkdir -p /root/.ssh && \
39
+ echo "$GIT_PRIVATE_KEY" > /root/.ssh/id_rsa && \
40
+ chmod 600 /root/.ssh/id_rsa && \
41
+ ssh-keyscan github.com >> /root/.ssh/known_hosts
42
+
43
+ # Clone your private repo
44
+ RUN git clone git@github.com:Sisyetad/problemsolution.git /app/private_repo
45
+ # ============================================
46
+
47
+ # Copy remaining app code
48
+ COPY --chown=appuser:appgroup . .
49
+
50
+ USER appuser
51
+
52
+ RUN chmod +x /app/entrypoint.sh
53
+
54
+ EXPOSE 8000
55
+
56
+ CMD ["sh", "/app/entrypoint.sh"]