Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.git
.venv
venv
# Ignore all files and directories by default
**/*

# Exception: allow files and folders essential for the build
!pyproject.toml
!poetry.lock
!app/
!Dockerfile
!Dockerfile.gpu
!README.md
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,31 @@ LABEL org.opencontainers.image.source="https://github.com/ahmetoner/whisper-asr-
ENV POETRY_VENV=/app/.venv

RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install --upgrade pip \
&& $POETRY_VENV/bin/pip install -U pip setuptools \
&& $POETRY_VENV/bin/pip install poetry==2.1.3

ENV PATH="${PATH}:${POETRY_VENV}/bin"

WORKDIR /app

COPY . .
COPY --from=ffmpeg /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui.css swagger-ui-assets/swagger-ui.css
COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js swagger-ui-assets/swagger-ui-bundle.js

# Copy poetry configuration files and install dependencies first to have them as cached docker layer
COPY pyproject.toml poetry.lock ./

RUN poetry config virtualenvs.in-project true
RUN poetry install --extras cpu

RUN --mount=type=cache,target=/root/.cache/pypoetry/artifacts \
poetry install --extras cpu --no-root --no-interaction --no-ansi

# Copy the rest of the application code
COPY . .

# Install the project itself (dependencies should come installed from previous layer)
RUN poetry install --extras cpu --no-interaction --no-ansi

EXPOSE 9000

Expand Down
16 changes: 14 additions & 2 deletions Dockerfile.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,32 @@ RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
ln -s -f /usr/bin/pip3 /usr/bin/pip

RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install --upgrade pip \
&& $POETRY_VENV/bin/pip install -U pip setuptools \
&& $POETRY_VENV/bin/pip install poetry==2.1.3

ENV PATH="${PATH}:${POETRY_VENV}/bin"

WORKDIR /app

COPY . .
COPY --from=ffmpeg /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui.css swagger-ui-assets/swagger-ui.css
COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js swagger-ui-assets/swagger-ui-bundle.js

# Copy poetry configuration files and install dependencies first to have them as cached docker layer
COPY pyproject.toml poetry.lock ./

RUN poetry config virtualenvs.in-project true
RUN poetry install --extras cuda

RUN --mount=type=cache,target=/root/.cache/pypoetry/artifacts \
poetry install --extras cuda --no-root --no-interaction --no-ansi

# Copy the rest of the application code
COPY . .

# Install the project itself (dependencies should come installed from previous layer)
RUN --mount=type=cache,target=/root/.cache/pypoetry/artifacts \
poetry install --extras cuda --no-interaction --no-ansi

EXPOSE 9000

Expand Down