moeflow-companion / Dockerfile
jokester's picture
make docker build happy
38763a8
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim
USER root
# for some reason huggingface run container images as uid=1000
RUN useradd -m -u 1000 runtime-user \
&& apt-get update && apt-get install --yes curl libgl1 libglib2.0-0 libgl1-mesa-glx
WORKDIR /app
RUN chown -Rc runtime-user /app
USER runtime-user
RUN mkdir -pv /app/storage \
&& uv venv --clear --python=3.11 /app/venv
RUN curl -L https://github.com/moeflow-com/manga-image-translator/archive/7513db7e8d4a9986e1b186f5fbd2146e39e392d0.tar.gz | tar xvz --strip-components=1
# not caching pip: HF space does not seem to have layer cache anyway
# the extra "setuptools" is necessary to run
RUN UV_PYTHON=venv uv pip install --no-cache -r requirements-moeflow.txt setuptools
# NOTE for unknown reason we need to download here. or there will be runtime file permission error
RUN venv/bin/python docker_prepare.py --models ocr.48px,ocr.48px_ctc,ocr.32px,ocr.mocr,detector.default,detector.ctd,detector.craft,detector.none
CMD ["venv/bin/python", "gradio-main.py"]