Skip to content

Commit

Permalink
Remove poetry from Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
greenw0lf committed Oct 9, 2024
1 parent 5caf5e2 commit 39c7599
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
32 changes: 20 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
FROM docker.io/python:3.11 AS req

RUN python3 -m pip install pipx && \
python3 -m pipx ensurepath

RUN pipx install poetry==1.8.2 && \
pipx inject poetry poetry-plugin-export && \
pipx run poetry config warnings.export false

COPY ./poetry.lock ./poetry.lock
COPY ./pyproject.toml ./pyproject.toml
RUN pipx run poetry export --format requirements.txt --output requirements.txt

FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04

# Install ffmpeg
# Install Python & ffmpeg
RUN apt-get update && \
apt-get install -y python3-pip python3.11-dev python-is-python3 ffmpeg && \
apt-get install -y python3.11-dev python3-pip python-is-python3 ffmpeg && \
rm -rf /var/lib/apt/lists/*

# Ensure Python 3.11 is used (for some reason, 3.10 is also installed...)
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1

# Create dirs for:
# - Storing the source code: /src
# - Storing the input & output files: /data
Expand All @@ -14,16 +30,8 @@ RUN mkdir /src /data /model

WORKDIR /src

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

RUN pip install poetry==1.8.2

COPY pyproject.toml poetry.lock ./

RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
COPY --from=req ./requirements.txt requirements.txt
RUN python -m pip install --no-cache-dir -r requirements.txt

# copy the rest into the source dir
COPY ./ /src
Expand Down
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

echo "Starting Whisper ASR worker"

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

echo "The worker has finished"

0 comments on commit 39c7599

Please sign in to comment.