Spaces:
Sleeping
Sleeping
File size: 1,717 Bytes
cb3558e 789bf58 cb3558e d688b0d cb3558e d688b0d e753721 789bf58 cb3558e 789bf58 cb3558e 789bf58 cb3558e 71d368c cb3558e 789bf58 cb3558e 71d368c cb3558e 789bf58 cb3558e | 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 | FROM ghcr.io/ggml-org/llama.cpp:server AS llama
FROM python:3.13-slim
# Install system deps
RUN apt-get update && apt-get install -y --no-install-recommends \
curl supervisor libgomp1 && rm -rf /var/lib/apt/lists/*
# Copy llama-server binary and backend .so files (must stay together)
COPY --from=llama /app /usr/local/lib/llama
RUN ln -s /usr/local/lib/llama/llama-server /usr/local/bin/llama-server \
&& echo /usr/local/lib/llama > /etc/ld.so.conf.d/llama.conf \
&& ldconfig
ENV LD_LIBRARY_PATH=/usr/local/lib/llama
# HF Spaces requires UID 1000
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Install dependencies (cache layer)
COPY --chown=user pyproject.toml uv.lock ./
RUN uv sync --frozen --no-install-project --extra demo
# Copy application code
COPY --chown=user src/ src/
COPY --chown=user assets/ assets/
COPY --chown=user gazet_demo.py .
RUN uv sync --frozen --extra demo
# Download model from HF
RUN uv run python -c "\
from huggingface_hub import hf_hub_download; \
hf_hub_download('developmentseed/gazet-model', 'models/ckpt-q8_0.gguf', local_dir='.')"
# Download geodata from HF (repo structure matches app's expected layout)
RUN uv run python -c "\
from huggingface_hub import snapshot_download; \
snapshot_download('developmentseed/gazet-geodata', repo_type='dataset', local_dir='data')"
COPY --chown=user supervisord.conf .
ENV GAZET_DATA_DIR=$HOME/app/data \
LLAMA_SERVER_URL=http://localhost:9000 \
GAZET_API_URL=http://localhost:8000 \
PATH="$HOME/app/.venv/bin:$PATH"
EXPOSE 7860
CMD ["supervisord", "-c", "supervisord.conf"]
|