File size: 2,251 Bytes
9dce458 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
FROM pytorch/pytorch:latest
RUN useradd -m -u 1000 user
WORKDIR /app
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive TZ=asia/shanghai apt-get -y install tzdata
# 设置缓存环境变量
ENV TRANSFORMERS_CACHE=/app/cache
ENV DEEPL_AUTH_KEY="6e4907cd-8926-42e7-aa5d-7561363c82b1:fx"
ENV OPENAI_API_KEY="sk-yuBWvBk2lTQoJFYP24A03515D46041429f907dE81cC3F04e"
ENV OPENAI_HTTP_PROXY="https://www.ygxdapi.top"
RUN mkdir -p /app/cache
# Assume root to install required dependencies
RUN apt-get install -y git g++ ffmpeg libsm6 libxext6 libvulkan-dev
# Install pip dependencies
COPY --chown=user requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
RUN pip install torchvision --force-reinstall
RUN pip install "numpy<2.0"
# RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
RUN apt-get remove -y g++ && \
apt-get autoremove -y
# Copy app
COPY --chown=user . /app
# Prepare models
RUN python -u docker_prepare.py
RUN rm -rf /tmp
# Add /app to Python module path
ENV PYTHONPATH="${PYTHONPATH}:/app"
WORKDIR /app
RUN mkdir -p /app/result && chmod 777 /app/result
RUN mkdir -p /app/models/translators && chmod 777 /app/models/translators
RUN mkdir -p /app/models/upscaling && chmod 777 /app/models/upscaling
RUN mkdir -p /app/cache/models && chmod 777 /app/cache/models
RUN mkdir -p /app/cache/.locks && chmod 777 /app/cache/.locks
RUN mkdir -p /app/cache/models--kha-white--manga-ocr-base && chmod 777 /app/cache/models--kha-white--manga-ocr-base
RUN mkdir -p /app && chmod 777 /app
ENTRYPOINT ["python", "-m", "manga_translator", "-v", "--mode", "web", "--host", "0.0.0.0", "--port", "7860", "--font-size", "28", "--font-size-offset", "5", "--unclip-ratio", "1.1", "--det-invert"]
# # ENTRYPOINT ["python", "-m", "manga_translator", "-v", "--mode", "web", "--host", "0.0.0.0", "--port", "7860", "--use-cuda", "--use-inpainting"]
# 使用指定的基础镜像
# FROM zyddnys/manga-image-translator:main
# 复制需要的文件到容器中
# COPY ./../../translate_demo.py /app/translate_demo.py
# # 暴露端口
# EXPOSE 7860
# # 运行命令
# CMD ["--verbose", "--log-web", "--mode", "web", "--use-inpainting", "--use-cuda", "--host=0.0.0.0", "--port=7860"] |