Skip to content

Commit

Permalink
Support docker build with label
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyao9184 committed Jan 4, 2025
1 parent 0f0be1c commit 4e1482c
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 10 additions & 1 deletion docker/build-without-fonts@pypi/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,32 @@ 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

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"]
11 changes: 10 additions & 1 deletion docker/build-without-fonts@source/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
11 changes: 10 additions & 1 deletion docker/build@pypi/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,37 @@ 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

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
COPY --from=fonts /fonts/GoNotoCurrent-Regular.ttf /opt/conda/lib/python3.11/site-packages/static/fonts/GoNotoCurrent-Regular.ttf
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"]
12 changes: 11 additions & 1 deletion docker/build@source/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"]

0 comments on commit 4e1482c

Please sign in to comment.