| |
| FROM python:3.10-slim |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends git \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m -u 1000 user && mkdir -p /app /data && chown -R user:user /app /data |
| USER user |
| ENV PATH="/home/user/.local/bin:${PATH}" |
|
|
| |
| ENV HF_HOME=/data/.cache/huggingface \ |
| API_DB_PATH=/data/api_keys.sqlite3 \ |
| DEFAULT_API_KEY=sk-1234 \ |
| MODEL_ID=TinyLlama/TinyLlama-1.1B-Chat-v1.0 \ |
| PORT=7860 |
|
|
| WORKDIR /app |
|
|
| |
| COPY --chown=user:user requirements.txt . |
| RUN pip install --no-cache-dir --upgrade pip \ |
| && pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu torch \ |
| && pip install --no-cache-dir -r requirements.txt |
|
|
| |
| COPY --chown=user:user . /app |
|
|
| |
| CMD python init_db.py && python server.py |
|
|
|
|