razaali10 commited on
Commit
5c7b91c
·
verified ·
1 Parent(s): beb8632

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -14
Dockerfile CHANGED
@@ -1,16 +1,16 @@
1
  # Hugging Face Docker Space -> KWR EPANET MCP server over Streamable HTTP.
2
- # Builds THIS repo's src/ (not the PyPI wheel) so local edits take effect.
3
- # Pinned to 3.11 (epyt wheels are reliable there; the repo's .python-version
4
- # says 3.13, which epyt does not always support yet).
 
 
 
5
  FROM python:3.11-slim
6
 
7
  # libgomp1: OpenMP runtime some numpy / EPANET-toolkit wheels expect.
8
  RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # uv builds the local package (its build backend is uv_build, per pyproject).
12
- RUN pip install --no-cache-dir uv
13
-
14
  # HF Spaces convention: non-root uid 1000.
15
  RUN useradd -m -u 1000 user
16
  USER user
@@ -22,15 +22,14 @@ ENV HOME=/home/user \
22
 
23
  WORKDIR /home/user/app
24
 
25
- # Install project + deps first (better layer caching), then bring in the rest.
26
- # uv.lock is intentionally NOT required here: `uv pip install .` resolves from
27
- # pyproject.toml. (Copying a non-existent uv.lock hard-fails the build.)
28
- COPY --chown=user pyproject.toml README.md ./
29
- COPY --chown=user src ./src
30
- RUN uv pip install --system . uvicorn
31
 
32
- # App code + bundled Networks/ (and everything else).
33
  COPY --chown=user . .
34
 
35
  EXPOSE 7860
36
- CMD ["python", "app.py"]
 
1
  # Hugging Face Docker Space -> KWR EPANET MCP server over Streamable HTTP.
2
+ #
3
+ # This variant installs the server from PyPI (identical code to this repo's
4
+ # src/, which is byte-for-byte upstream 0.2.0) instead of building local
5
+ # source. That keeps the build robust even if src/ or uv.lock aren't present
6
+ # in the Space's build context. The only files this image needs from the
7
+ # context are app.py and the Networks/ folder.
8
  FROM python:3.11-slim
9
 
10
  # libgomp1: OpenMP runtime some numpy / EPANET-toolkit wheels expect.
11
  RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \
12
  && rm -rf /var/lib/apt/lists/*
13
 
 
 
 
14
  # HF Spaces convention: non-root uid 1000.
15
  RUN useradd -m -u 1000 user
16
  USER user
 
22
 
23
  WORKDIR /home/user/app
24
 
25
+ # Install the server + transport deps directly (no local build step, so a
26
+ # missing src/ or uv.lock can't fail the build). mcp-server-epanet pulls
27
+ # epyt, mcp[cli], numpy, matplotlib as dependencies.
28
+ RUN pip install --no-cache-dir --upgrade pip \
29
+ && pip install --no-cache-dir "mcp-server-epanet==0.2.0" uvicorn
 
30
 
31
+ # Copy whatever the context has (app.py, Networks/, README, ...).
32
  COPY --chown=user . .
33
 
34
  EXPOSE 7860
35
+ CMD ["python", "app.py"]