Skip to content
Open
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
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM swaggerapi/swagger-ui:v5.9.1 AS swagger-ui
FROM python:3.10-slim

RUN useradd -m service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maps to an arbitrary user id that may or may not exist on the Docker host, right? So if you want asr to, for example, cache models in mounted volumes (mounted to host folders), those folders on the host would need to be owned by the same user id and have proper permissions.


ENV POETRY_VENV=/app/.venv

RUN export DEBIAN_FRONTEND=noninteractive \
Expand All @@ -9,6 +11,10 @@ RUN export DEBIAN_FRONTEND=noninteractive \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /app && chown -R service:service /app

USER service

RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install -U pip setuptools \
&& $POETRY_VENV/bin/pip install poetry==1.6.1
Expand All @@ -24,4 +30,6 @@ COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js swagger-ui-ass
RUN poetry config virtualenvs.in-project true
RUN poetry install

USER service

ENTRYPOINT ["gunicorn", "--bind", "0.0.0.0:9000", "--workers", "1", "--timeout", "0", "app.webservice:app", "-k", "uvicorn.workers.UvicornWorker"]