From 4e1482c7533436a85fe4422e26e4d55ce495afac Mon Sep 17 00:00:00 2001 From: xiaoyao9184 <6614349+xiaoyao9184@users.noreply.github.com> Date: Sat, 4 Jan 2025 11:21:33 +0800 Subject: [PATCH] Support docker build with label --- .dockerignore | 14 ++++++++++++++ docker/build-without-fonts@pypi/dockerfile | 11 ++++++++++- docker/build-without-fonts@source/dockerfile | 11 ++++++++++- docker/build@pypi/dockerfile | 11 ++++++++++- docker/build@source/dockerfile | 12 +++++++++++- 5 files changed, 55 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index e44bdb1..7f7989e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,5 +10,19 @@ surya/poetry.lock gradio/requirements.txt +label/__pycache__/ +label/.pytest_cache/ +label/test_images/ +label/.gitignore +label/cache.db +label/requirements_base.txt +label/requirements_dev.txt +label/requirements_text.txt +label/requirements.txt +label/test_api.py + # Ignore generated files **/*.pyc + +# Ignore generated files +**/cache.db diff --git a/docker/build-without-fonts@pypi/dockerfile b/docker/build-without-fonts@pypi/dockerfile index 099bd2a..5a50c94 100644 --- a/docker/build-without-fonts@pypi/dockerfile +++ b/docker/build-without-fonts@pypi/dockerfile @@ -17,6 +17,7 @@ RUN apt-get update && apt-get install -y \ libxext6 \ libglib2.0-0 \ libxrender-dev \ + git \ && rm -rf /var/lib/apt/lists/* RUN pip3 install --upgrade pip @@ -24,16 +25,24 @@ RUN pip3 install --upgrade pip RUN pip3 install --no-cache-dir \ surya-ocr==${SURYA_VERSION} \ streamlit==${STREAMLIT_VERSION} \ - gradio==${GRADIO_VERSION} + gradio==${GRADIO_VERSION} \ + gunicorn==22.0.0 \ + git+https://github.com/HumanSignal/label-studio-ml-backend.git@1a37d2f#egg=label-studio-ml \ + boto3==1.35.91 COPY ./gradio /workspace/gradio +COPY ./label /workspace/label EXPOSE 8501 EXPOSE 7860 +EXPOSE 9090 VOLUME /root/.cache +VOLUME /workspace/label/.pytest_cache +# VOLUME /workspace/label/cache.db ENV APP_PATH=/app ENV GRADIO_SERVER_NAME="0.0.0.0" +ENV LABEL_STUDIO_URL=http://label-studio:8080 CMD ["surya_gui"] diff --git a/docker/build-without-fonts@source/dockerfile b/docker/build-without-fonts@source/dockerfile index 83032db..1e402d7 100644 --- a/docker/build-without-fonts@source/dockerfile +++ b/docker/build-without-fonts@source/dockerfile @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \ libxext6 \ libglib2.0-0 \ libxrender-dev \ + git \ && rm -rf /var/lib/apt/lists/* RUN pip3 install --upgrade pip @@ -17,19 +18,27 @@ COPY ./surya /app RUN pip3 install --no-cache-dir \ -e . \ streamlit==1.41.1 \ - gradio==5.8.0 + gradio==5.8.0 \ + gunicorn==22.0.0 \ + git+https://github.com/HumanSignal/label-studio-ml-backend.git@master#egg=label-studio-ml \ + boto3==1.35.91 # The image is too large, exceeding 30GB. # RUN pip3 install poetry # RUN poetry install --no-root --with dev COPY ./gradio /workspace/gradio +COPY ./label /workspace/label EXPOSE 8501 EXPOSE 7860 +EXPOSE 9090 VOLUME /root/.cache +VOLUME /workspace/label/.pytest_cache +# VOLUME /workspace/label/cache.db ENV APP_PATH=/app ENV GRADIO_SERVER_NAME="0.0.0.0" +ENV LABEL_STUDIO_URL=http://label-studio:8080 CMD ["surya_gui"] diff --git a/docker/build@pypi/dockerfile b/docker/build@pypi/dockerfile index d439e59..f049541 100644 --- a/docker/build@pypi/dockerfile +++ b/docker/build@pypi/dockerfile @@ -26,6 +26,7 @@ RUN apt-get update && apt-get install -y \ libxext6 \ libglib2.0-0 \ libxrender-dev \ + git \ && rm -rf /var/lib/apt/lists/* RUN pip3 install --upgrade pip @@ -33,7 +34,10 @@ RUN pip3 install --upgrade pip RUN pip3 install --no-cache-dir \ surya-ocr==${SURYA_VERSION} \ streamlit==${STREAMLIT_VERSION} \ - gradio==${GRADIO_VERSION} + gradio==${GRADIO_VERSION} \ + gunicorn==22.0.0 \ + git+https://github.com/HumanSignal/label-studio-ml-backend.git@1a37d2f#egg=label-studio-ml \ + boto3==1.35.91 # COPY --from=fonts /fonts/GoNotoCurrent-Regular.ttf /fonts/GoNotoCurrent-Regular.ttf # COPY --from=fonts /fonts/GoNotoCJKCore.ttf /fonts/GoNotoCJKCore.ttf @@ -41,13 +45,18 @@ COPY --from=fonts /fonts/GoNotoCurrent-Regular.ttf /opt/conda/lib/python3.11/sit COPY --from=fonts /fonts/GoNotoCJKCore.ttf /opt/conda/lib/python3.11/site-packages/static/fonts/GoNotoCJKCore.ttf COPY ./gradio /workspace/gradio +COPY ./label /workspace/label EXPOSE 8501 EXPOSE 7860 +EXPOSE 9090 VOLUME /root/.cache +VOLUME /workspace/label/.pytest_cache +# VOLUME /workspace/label/cache.db ENV APP_PATH=/app ENV GRADIO_SERVER_NAME="0.0.0.0" +ENV LABEL_STUDIO_URL=http://label-studio:8080 CMD ["surya_gui"] diff --git a/docker/build@source/dockerfile b/docker/build@source/dockerfile index 88566cc..b79f235 100644 --- a/docker/build@source/dockerfile +++ b/docker/build@source/dockerfile @@ -18,6 +18,7 @@ RUN apt-get update && apt-get install -y \ libxext6 \ libglib2.0-0 \ libxrender-dev \ + git \ && rm -rf /var/lib/apt/lists/* RUN pip3 install --upgrade pip @@ -26,7 +27,11 @@ COPY ./surya /app RUN pip3 install --no-cache-dir \ -e . \ streamlit==1.41.1 \ - gradio==5.8.0 + gradio==5.8.0 \ + gunicorn==22.0.0 \ + git+https://github.com/HumanSignal/label-studio-ml-backend.git@master#egg=label-studio-ml \ + boto3==1.35.91 + # The image is too large, with layers exceeding 10GB. # RUN pip3 install poetry # RUN poetry install --no-root --with dev @@ -37,13 +42,18 @@ COPY --from=fonts /fonts/GoNotoCurrent-Regular.ttf /opt/conda/lib/python3.11/sit COPY --from=fonts /fonts/GoNotoCJKCore.ttf /opt/conda/lib/python3.11/site-packages/static/fonts/GoNotoCJKCore.ttf COPY ./gradio /workspace/gradio +COPY ./label /workspace/label EXPOSE 8501 EXPOSE 7860 +EXPOSE 9090 VOLUME /root/.cache +VOLUME /workspace/label/.pytest_cache +# VOLUME /workspace/label/cache.db ENV APP_PATH=/app ENV GRADIO_SERVER_NAME="0.0.0.0" +ENV LABEL_STUDIO_URL=http://label-studio:8080 CMD ["surya_gui"]