File size: 1,511 Bytes
042f41e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21c130f
042f41e
 
 
 
 
 
1da2860
f835a65
042f41e
 
18a2bb2
042f41e
 
 
7e8ef49
293c81c
b1c0ef3
293c81c
 
4048b9a
042f41e
 
293c81c
042f41e
115384d
042f41e
 
6bf9db6
042f41e
293c81c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM python:3.11-slim-bookworm

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    UV_HTTP_TIMEOUT=120 \
    UV_HTTP_MAX_RETRIES=5 \
    HF_HOME=/tmp/hf_cache \
    TRANSFORMERS_CACHE=/tmp/hf_cache

# Create a non-root user
RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser

WORKDIR /app

# Install git + ssh utilities
RUN apt-get update && apt-get install -y \
    curl \
    git \
    openssh-client \
    netcat-openbsd \
 && rm -rf /var/lib/apt/lists/*

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

COPY requirements.txt . 

RUN uv pip install --system --upgrade pip setuptools wheel
RUN uv pip install --system torch==2.8.0+cpu --index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --system -r requirements.txt

# ========== PRIVATE GIT CLONE BLOCK ==========
ARG GIT_PRIVATE_KEY

# Configure SSH for GitHub
RUN mkdir -p /root/.ssh && \
    printf "%b" "$GIT_PRIVATE_KEY" > /root/.ssh/id_rsa && \
    chmod 600 /root/.ssh/id_rsa && \
    ssh-keyscan github.com >> /root/.ssh/known_hosts

# Clone private repo into a folder

RUN git clone git@github.com:Sisyetad/problemsolution.git /app/CreativeMind && \
    chown -R appuser:appgroup /app/CreativeMind/ProblemSolution && \
    chmod +x /app/CreativeMind/ProblemSolution/entrypoint.sh

# ============================================

WORKDIR /app/CreativeMind/ProblemSolution

# Switch to non-root user 
USER appuser

EXPOSE 7860

CMD ["sh", "/app/CreativeMind/ProblemSolution/entrypoint.sh"]