Kaballas's picture
s
74cc69f
raw
history blame
1.41 kB
FROM python:3.10-slim
# Install system dependencies
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/*
# Set up MariaDB dependencies
RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup && \
echo "c4a0f3dade02c51a6a28ca3609a13d7a0f8910cccbb90935a2f218454d3a914a mariadb_repo_setup" | sha256sum -c - && \
chmod +x mariadb_repo_setup && \
./mariadb_repo_setup --mariadb-server-version="mariadb-11.7" && \
rm mariadb_repo_setup && \
apt-get update && \
apt-get install -y --no-install-recommends libmariadb3 libmariadb-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install uv
RUN pip install --no-cache-dir uv
# HF Spaces: Create user with ID 1000
RUN useradd -m -u 1000 user
WORKDIR /app
RUN chown -R user:user /app
# Copy project files with proper ownership
COPY --chown=user . /app
# Install dependencies globally (no virtual environment)
ENV UV_NO_CACHE=1
ENV UV_CACHE_DIR=/dev/null
# Install the package directly to system Python
RUN pip install -e .
# Switch to user
USER user
# HF Spaces requirements
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PORT=7860
EXPOSE 7860
# Run the package directly
CMD ["sh", "-c", "python -m mcp_server_mariadb_vector --transport sse --host 0.0.0.0 --port $PORT"]