Skip to content

Commit

Permalink
Rewrite Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
gb-beng committed Aug 30, 2024
1 parent 80fe804 commit 2f1ea0c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
44 changes: 24 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
ENTRYPOINT ["./docker-entrypoint.sh"]
4 changes: 2 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

echo "Starting DANE Whisper ASR worker"

poetry run python worker.py "$@"
python worker.py "$@"

echo "The worker has finished"
echo "The worker has finished"

0 comments on commit 2f1ea0c

Please sign in to comment.