From a16b927e0f1aa7947897f4450146e46365b89650 Mon Sep 17 00:00:00 2001 From: mehmetemineker Date: Mon, 6 Oct 2025 21:19:37 +0300 Subject: [PATCH 1/2] refactor: update Dockerfile to set WORKDIR directly and replace start.sh with CMD for segment_anything_2_image --- label_studio_ml/examples/segment_anything_2_image/Dockerfile | 4 ++-- label_studio_ml/examples/segment_anything_2_image/start.sh | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) delete mode 100755 label_studio_ml/examples/segment_anything_2_image/start.sh diff --git a/label_studio_ml/examples/segment_anything_2_image/Dockerfile b/label_studio_ml/examples/segment_anything_2_image/Dockerfile index 36ad49bd..02e97328 100644 --- a/label_studio_ml/examples/segment_anything_2_image/Dockerfile +++ b/label_studio_ml/examples/segment_anything_2_image/Dockerfile @@ -56,6 +56,6 @@ RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ COPY . ./ -WORKDIR ../sam2 +WORKDIR /sam2 -CMD ["../app/start.sh"] \ No newline at end of file +CMD ["gunicorn", "--bind", ":9090", "--workers", "1", "--threads", "8", "--timeout", "0", "--pythonpath", "/app", "_wsgi:app"] \ No newline at end of file diff --git a/label_studio_ml/examples/segment_anything_2_image/start.sh b/label_studio_ml/examples/segment_anything_2_image/start.sh deleted file mode 100755 index 204d2c57..00000000 --- a/label_studio_ml/examples/segment_anything_2_image/start.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# Execute the gunicorn command -exec gunicorn --bind :${PORT:-9090} --workers ${WORKERS:-1} --threads ${THREADS:-4} --timeout 0 --pythonpath '/app' _wsgi:app From 152790bba1facd7f18986cc319d43deb068827a5 Mon Sep 17 00:00:00 2001 From: mehmetemineker Date: Mon, 6 Oct 2025 21:22:06 +0300 Subject: [PATCH 2/2] fix: update CMD in Dockerfile to use dynamic worker and thread variables for segment_anything_2_image --- label_studio_ml/examples/segment_anything_2_image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/label_studio_ml/examples/segment_anything_2_image/Dockerfile b/label_studio_ml/examples/segment_anything_2_image/Dockerfile index 02e97328..c5286b88 100644 --- a/label_studio_ml/examples/segment_anything_2_image/Dockerfile +++ b/label_studio_ml/examples/segment_anything_2_image/Dockerfile @@ -58,4 +58,4 @@ COPY . ./ WORKDIR /sam2 -CMD ["gunicorn", "--bind", ":9090", "--workers", "1", "--threads", "8", "--timeout", "0", "--pythonpath", "/app", "_wsgi:app"] \ No newline at end of file +CMD ["gunicorn", "--bind", ":9090", "--workers", "${WORKERS}", "--threads", "${THREADS}", "--timeout", "0", "--pythonpath", "/app", "_wsgi:app"]