diff --git a/Dockerfile b/Dockerfile index 908e13b..e952220 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/docker-compose.yml b/docker-compose.yml index d58d222..90879cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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", ] diff --git a/pyproject.toml b/pyproject.toml index 02b3b89..be8c548 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,6 @@ dependencies = [ "numpy", "requests", "kaibu-utils", - "cachetools", ] [tool.setuptools] diff --git a/requirements-sam.txt b/requirements-sam.txt index 90422eb..6af2dcb 100644 --- a/requirements-sam.txt +++ b/requirements-sam.txt @@ -1,4 +1,5 @@ -r "requirements.txt" torch==2.3.1 torchvision==0.18.1 -segment_anything==1.0 \ No newline at end of file +segment_anything==1.0 +cachetools==5.5.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2168963..a12b3ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/start_service.sh b/start_service.sh new file mode 100644 index 0000000..f43309d --- /dev/null +++ b/start_service.sh @@ -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 "$@"