Skip to content
Snippets Groups Projects
Commit 033eb23f authored by Jan Hartig's avatar Jan Hartig
Browse files

Use Multi-Stage build for better build caching

parent b12418be
Branches
Tags v0.12.0
No related merge requests found
FROM ghcr.io/opennmt/ctranslate2:latest-ubuntu20.04-cuda11.2
FROM ghcr.io/opennmt/ctranslate2:latest-ubuntu20.04-cuda11.2 as base
# install faster-whisper
RUN python3 -m pip --no-cache-dir install faster-whisper tqdm
# faster-whisper is always needed, install in base
RUN python3 -m pip --no-cache-dir install faster-whisper
# create huggingface home
RUN mkdir /hf
ENV HF_HOME=/hf
# preload model
RUN python3 -c "import faster_whisper; faster_whisper.download_model('large-v2')"
# Download model in new container to for better build caching
FROM base as downloader
# download model and set permissions
RUN python3 -c "import faster_whisper; faster_whisper.download_model('large-v2')" && chmod -R 755 /hf
# fix permissions
RUN chmod -R 755 /hf
# Actual container starts here
FROM base
# Copy model
COPY --from=downloader /hf /hf
# install dependencies
RUN python3 -m pip --no-cache-dir install tqdm
COPY main.py .
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment