Skip to content

Commit

Permalink
ensure latest hypha_rpc version in docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsmechtel committed Sep 19, 2024
1 parent b82c001 commit 17d9195
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@ RUN pip install -r /app/requirements-sam.txt
# Copy the python script to the docker environment
COPY ./bioimageio_colab/register_sam_service.py /app/register_sam_service.py

# Copy the start service script
COPY ./start_service.sh /app/start_service.sh

# Change ownership of the application directory to the non-root user
RUN chown -R bioimageio_colab:bioimageio_colab /app/

# Add a build argument for cache invalidation
ARG CACHEBUST=1

# Fetch the Hypha server version and reinstall or upgrade hypha-rpc to the matching version
RUN HYPHA_VERSION=$(curl -s https://hypha.aicell.io/assets/config.json | jq -r '.hypha_version') && \
pip install --upgrade "hypha-rpc<=$HYPHA_VERSION"
# Make the start script executable
RUN chmod +x /app/start_service.sh

# Switch to the non-root user
USER bioimageio_colab

# Register the segmentation model as a hypha service
ENTRYPOINT ["python", "register_sam_service.py"]
# Use the start script as the entrypoint and forward arguments
ENTRYPOINT ["/app/start_service.sh"]
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
CACHEBUST: ${CACHEBUST}
image: ghcr.io/bioimage-io/bioimageio-colab:latest
env_file:
- .env
command: [
"--server_url=https://hypha.aicell.io",
"--workspace_name=bioimageio-colab",
"--client_id=model-server",
"--service_id=interactive-segmentation",
"--client_id=kubernetes",
"--service_id=sam",
]
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies = [
"numpy",
"requests",
"kaibu-utils",
"cachetools",
]

[tool.setuptools]
Expand Down
3 changes: 2 additions & 1 deletion requirements-sam.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-r "requirements.txt"
torch==2.3.1
torchvision==0.18.1
segment_anything==1.0
segment_anything==1.0
cachetools==5.5.0
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ numpy==1.26.4
requests==2.31.0
kaibu-utils==0.1.14
python-dotenv==1.0.1
cachetools==5.5.0
6 changes: 6 additions & 0 deletions start_service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# Upgrade hypha-rpc
pip install --upgrade hypha-rpc

# Pass all arguments to the Python script
python register_sam_service.py "$@"

0 comments on commit 17d9195

Please sign in to comment.