From 2f1ea0c779e73daad91d66d921fdb8c840c43793 Mon Sep 17 00:00:00 2001 From: Govert Brinkmann Date: Wed, 28 Aug 2024 11:07:06 +0200 Subject: [PATCH] Rewrite Dockerfile --- Dockerfile | 44 ++++++++++++++++++++++++-------------------- docker-entrypoint.sh | 4 ++-- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7ae1c2a..a657d57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,37 @@ -FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 +FROM docker.io/python:3.10@sha256:c6b64ba9c0f03c41e10f1e6053ca2ecf2dbced44098f8d56ed579aa50e839889 AS req -# Create dirs for: -# - Injecting config.yml: /root/.DANE -# - Mount point for input & output files: /mnt/dane-fs -# - Storing the source code: /src -# - Storing the model: /model -RUN mkdir /root/.DANE /mnt/dane-fs /src /data /model +RUN python3 -m pip install pipx && \ + python3 -m pipx ensurepath -RUN apt-get update && \ - apt-get install -y python3-pip python3-dev python-is-python3 && \ - rm -rf /var/lib/apt/lists/* +RUN pipx install poetry==1.7.1 && \ + pipx inject poetry poetry-plugin-export && \ + pipx run poetry config warnings.export false -WORKDIR /src +COPY ./poetry.lock ./poetry.lock +COPY ./pyproject.toml ./pyproject.toml +RUN pipx run poetry export --format requirements.txt --output requirements.txt -ENV POETRY_NO_INTERACTION=1 \ - POETRY_VIRTUALENVS_IN_PROJECT=1 \ - POETRY_VIRTUALENVS_CREATE=1 \ - POETRY_CACHE_DIR=/tmp/poetry_cache +FROM docker.io/python:3.10@sha256:c6b64ba9c0f03c41e10f1e6053ca2ecf2dbced44098f8d56ed579aa50e839889 -RUN pip install poetry==1.8.2 +# Create dirs for: +# - Injecting config.yml: /root/.DANE +# - Mount point for input & output files: /data +# - Storing the source code: /src +RUN mkdir \ + /data \ + /mnt/dane-fs \ + /model \ + /root/.DANE \ + /src -COPY pyproject.toml poetry.lock ./ +WORKDIR /src -RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR +COPY --from=req ./requirements.txt requirements.txt +RUN pip install --no-cache-dir -r requirements.txt -# copy the rest into the source dir COPY ./ /src # Write provenance info about software versions to file RUN echo "dane-whisper-asr-worker;https://github.com/beeldengeluid/dane-whisper-asr-worker/commit/$(git rev-parse HEAD)" >> /software_provenance.txt -ENTRYPOINT ["./docker-entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["./docker-entrypoint.sh"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 0f2fc01..1d2ac75 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,6 +2,6 @@ echo "Starting DANE Whisper ASR worker" -poetry run python worker.py "$@" +python worker.py "$@" -echo "The worker has finished" \ No newline at end of file +echo "The worker has finished"