commitcopilot/infer-002
0
1FROM python:3.11-slim2 3ENV PYTHONDONTWRITEBYTECODE=1 \4 PYTHONUNBUFFERED=1 \5 PORT=7860 \6 LLAMA_SERVER_HOST=127.0.0.1 \7 LLAMA_SERVER_PORT=8080 \8 LD_LIBRARY_PATH=/opt/llama.cpp9 10WORKDIR /app11 12RUN apt-get update && \13 apt-get install -y --no-install-recommends \14 ca-certificates \15 curl \16 gzip \17 libgomp1 \18 libstdc++6 \19 tar && \20 rm -rf /var/lib/apt/lists/*21 22COPY scripts/install_llama_cpp.py ./scripts/install_llama_cpp.py23RUN python scripts/install_llama_cpp.py24 25COPY requirements.txt ./26RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \27 pip install --no-cache-dir -r requirements.txt28 29COPY config.json ./config.json30COPY scripts/download_model.py ./scripts/download_model.py31 32ARG HF_TOKEN=""33RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=false \34 sh -c 'TOKEN="${HF_TOKEN}"; \35 if [ -f /run/secrets/HF_TOKEN ]; then TOKEN="$(cat /run/secrets/HF_TOKEN)"; fi; \36 python scripts/download_model.py \37 --config config.json \38 --output-dir /models \39 --hf-token "${TOKEN}"'40 41COPY app.py ./42 43EXPOSE 786044CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"]45 