File size: 1,947 Bytes
644bdfe 22f28c2 644bdfe 9c1e1f6 22f28c2 644bdfe 9c1e1f6 bedc715 22f28c2 644bdfe 4bae965 74cc69f a089a6b 9c1e1f6 bedc715 5e08e2d a089a6b 22f28c2 bedc715 22f28c2 9123b55 bedc715 9c1e1f6 644bdfe 9b88aa8 a1be2d1 d7da6ee |
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 |
FROM python:3.10-slim
# ββ Base OS packages βββββββββββββββββββββββββββββββββββββββββββββββ
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc python3-dev openssl curl ca-certificates gnupg build-essential \
&& rm -rf /var/lib/apt/lists/*
# ββ MariaDB client libs ββββββββββββββββββββββββββββββββββββββββββββ
RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup && \
chmod +x mariadb_repo_setup && ./mariadb_repo_setup --mariadb-server-version="mariadb-11.7" && \
apt-get update && apt-get install -y --no-install-recommends \
libmariadb3 libmariadb-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# ββ Python tooling ββββββββββββββββββββββββββββββββββββββββββββββββ
RUN pip install --no-cache-dir uv==0.1.37
RUN useradd -m -u 1000 user
WORKDIR /app
# Copy project files
COPY . /app
# Fix permissions so the unprivileged user can write to /app
RUN chown -R user:user /app
# Ensure our src/ is on the Python path so our local code is used
ENV PYTHONPATH=/app/src
# Install project (editable) + FastAPI stack in one layer
RUN uv pip install -e . --system && \
uv pip install fastapi uvicorn[standard] --system
# ββ Unprivileged user βββββββββββββββββββββββββββββββββββββββββββββ
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
UV_NO_CACHE=1 \
UV_CACHE_DIR=/dev/null \
PORT=7860
EXPOSE 7860
# Run the server using uv as a module, compatible with Hugging Face Spaces
CMD ["uv", "run", "mcp_server_mariadb_vector", "--host", "0.0.0.0", "--port", "7860"]
|