Kaballas commited on
Commit
bedc715
·
1 Parent(s): d2951fc
Files changed (1) hide show
  1. Dockerfile +24 -9
Dockerfile CHANGED
@@ -24,20 +24,35 @@ RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup && \
24
  apt-get clean && \
25
  rm -rf /var/lib/apt/lists/*
26
 
 
 
 
 
 
 
 
27
  WORKDIR /app
28
 
29
- # Copy requirements first for better cache usage
30
- COPY requirements.txt /app/
 
 
 
 
 
 
 
31
 
32
- # Install Python dependencies
33
- RUN pip install --no-cache-dir -r requirements.txt
34
 
35
- # Copy the rest of your code
36
- COPY . /app
 
37
 
38
- # Hugging Face Spaces expects your app to listen on $PORT
39
  EXPOSE 7860
40
  ENV PORT=7860
41
 
42
- # Run your app (update this to your actual entrypoint if needed)
43
- CMD ["python", "-m", "mcp-server-mariadb-vector", "--transport", "sse", "--host", "0.0.0.0", "--port", "7860"]
 
24
  apt-get clean && \
25
  rm -rf /var/lib/apt/lists/*
26
 
27
+ # HF Spaces requirement: Create user with ID 1000
28
+ RUN useradd -m -u 1000 user
29
+
30
+ # Install uv package manager
31
+ RUN pip install --no-cache-dir uv
32
+
33
+ # Set working directory
34
  WORKDIR /app
35
 
36
+ # HF Spaces requirement: Use /tmp for cache to avoid permission issues
37
+ ENV UV_CACHE_DIR=/tmp/uvcache
38
+ RUN mkdir -p ${UV_CACHE_DIR} && chmod -R 777 ${UV_CACHE_DIR}
39
+
40
+ # Copy project files with proper ownership
41
+ COPY --chown=user . /app
42
+
43
+ # Install project dependencies and clean git cache to avoid permission issues
44
+ RUN uv sync && rm -rf ${UV_CACHE_DIR}/git-v0 || true
45
 
46
+ # HF Spaces requirement: Switch to user
47
+ USER user
48
 
49
+ # HF Spaces requirement: Set user environment
50
+ ENV HOME=/home/user \
51
+ PATH=/home/user/.local/bin:$PATH
52
 
53
+ # HF Spaces requirement: Expose port 7860
54
  EXPOSE 7860
55
  ENV PORT=7860
56
 
57
+ # Run the MCP server with SSE transport for web accessibility
58
+ CMD ["sh", "-c", "uv run mcp-server-mariadb-vector --transport sse --host 0.0.0.0 --port $PORT"]