xx
Browse files- Dockerfile +27 -16
Dockerfile
CHANGED
@@ -2,47 +2,58 @@ FROM python:3.10-slim
|
|
2 |
|
3 |
# Install system dependencies
|
4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
5 |
-
gcc
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
rm -rf /var/lib/apt/lists/*
|
7 |
|
8 |
-
# Set up MariaDB dependencies
|
9 |
RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup && \
|
10 |
echo "c4a0f3dade02c51a6a28ca3609a13d7a0f8910cccbb90935a2f218454d3a914a mariadb_repo_setup" | sha256sum -c - && \
|
11 |
chmod +x mariadb_repo_setup && \
|
12 |
./mariadb_repo_setup --mariadb-server-version="mariadb-11.7" && \
|
13 |
rm mariadb_repo_setup && \
|
14 |
apt-get update && \
|
15 |
-
apt-get install -y --no-install-recommends
|
16 |
-
|
|
|
|
|
|
|
17 |
|
18 |
-
# Install uv
|
19 |
RUN pip install --no-cache-dir uv
|
20 |
|
21 |
-
# HF Spaces: Create user with ID 1000
|
22 |
RUN useradd -m -u 1000 user
|
23 |
|
|
|
24 |
WORKDIR /app
|
25 |
RUN chown -R user:user /app
|
26 |
|
27 |
# Copy project files with proper ownership
|
28 |
COPY --chown=user . /app
|
29 |
|
30 |
-
#
|
|
|
|
|
|
|
31 |
ENV UV_NO_CACHE=1
|
32 |
ENV UV_CACHE_DIR=/dev/null
|
33 |
|
34 |
-
# Install
|
35 |
-
RUN pip install -e .
|
36 |
-
|
37 |
-
# Switch to user
|
38 |
-
USER user
|
39 |
|
40 |
# HF Spaces requirements
|
41 |
ENV HOME=/home/user \
|
42 |
-
PATH=/home/user/.local/bin:$PATH
|
43 |
-
PORT=7860
|
44 |
|
|
|
45 |
EXPOSE 7860
|
|
|
46 |
|
47 |
-
#
|
48 |
-
CMD ["sh", "-c", "
|
|
|
2 |
|
3 |
# Install system dependencies
|
4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
5 |
+
gcc \
|
6 |
+
python3-dev \
|
7 |
+
openssl \
|
8 |
+
curl \
|
9 |
+
ca-certificates \
|
10 |
+
gnupg \
|
11 |
+
build-essential && \
|
12 |
rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
+
# Set up MariaDB's Python connector dependencies
|
15 |
RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup && \
|
16 |
echo "c4a0f3dade02c51a6a28ca3609a13d7a0f8910cccbb90935a2f218454d3a914a mariadb_repo_setup" | sha256sum -c - && \
|
17 |
chmod +x mariadb_repo_setup && \
|
18 |
./mariadb_repo_setup --mariadb-server-version="mariadb-11.7" && \
|
19 |
rm mariadb_repo_setup && \
|
20 |
apt-get update && \
|
21 |
+
apt-get install -y --no-install-recommends \
|
22 |
+
libmariadb3 \
|
23 |
+
libmariadb-dev && \
|
24 |
+
apt-get clean && \
|
25 |
+
rm -rf /var/lib/apt/lists/*
|
26 |
|
27 |
+
# Install uv package manager
|
28 |
RUN pip install --no-cache-dir uv
|
29 |
|
30 |
+
# HF Spaces requirement: Create user with ID 1000
|
31 |
RUN useradd -m -u 1000 user
|
32 |
|
33 |
+
# Set working directory and ownership
|
34 |
WORKDIR /app
|
35 |
RUN chown -R user:user /app
|
36 |
|
37 |
# Copy project files with proper ownership
|
38 |
COPY --chown=user . /app
|
39 |
|
40 |
+
# Switch to user before package installation
|
41 |
+
USER user
|
42 |
+
|
43 |
+
# Disable uv cache to prevent permission issues
|
44 |
ENV UV_NO_CACHE=1
|
45 |
ENV UV_CACHE_DIR=/dev/null
|
46 |
|
47 |
+
# Install dependencies using uv with system-wide installation
|
48 |
+
RUN uv pip install -e . --system
|
|
|
|
|
|
|
49 |
|
50 |
# HF Spaces requirements
|
51 |
ENV HOME=/home/user \
|
52 |
+
PATH=/home/user/.local/bin:$PATH
|
|
|
53 |
|
54 |
+
# HF Spaces requirement: Expose port 7860
|
55 |
EXPOSE 7860
|
56 |
+
ENV PORT=7860
|
57 |
|
58 |
+
# Use the console script entry point with SSE transport
|
59 |
+
CMD ["sh", "-c", "mcp-server-mariadb-vector --transport sse --host 0.0.0.0 --port $PORT"]
|