moeflow-companion / Dockerfile
jokester's picture
fix
baab53e
FROM mambaorg/micromamba:2-debian12-slim
COPY . /home/mambauser/bootstrap
RUN --mount=type=cache,uid=57439,gid=57439,target=/opt/conda/pkgs micromamba env create --yes --file /home/mambauser/bootstrap/conda.yaml \
&& micromamba install -n base --yes curl
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 libgl1 libglib2.0-0 libgl1-mesa-glx
WORKDIR /app
RUN chown -Rc runtime-user /app
USER runtime-user
RUN mkdir -pv /app/storage \
&& micromamba run -n mit-py311 python3 -mvenv --system-site-packages /app/venv
# HF does not seem to have layer cache anyway
# (must specify -n base to use installed curl)
RUN micromamba run -n base curl -L https://github.com/moeflow-com/manga-image-translator/archive/f783108054bd4ea452e381fae6ac3ea10d0a8327.tar.gz | tar xvz --strip-components=1
RUN venv/bin/pip install --no-cache-dir -r requirements-moeflow.txt
# 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