forked from ahmetoner/whisper-asr-webservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.gpu
45 lines (36 loc) · 1.4 KB
/
Dockerfile.gpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Use Ubuntu 22.04 with DeadSnakes PPA for Python
FROM deadsnakes/ppa:ubuntu-2204-3.10
# Set environment variables
ENV PYTHON_VERSION=3.10
ENV POETRY_VENV=/app/.venv
# Install required packages
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \
&& apt-get -qq install --no-install-recommends \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-venv \
python3-pip \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Create symbolic links for Python and pip
RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
ln -s -f /usr/bin/pip3 /usr/bin/pip
# Create a Python virtual environment
RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install -U pip setuptools \
&& $POETRY_VENV/bin/pip install poetry==1.4.0
# Add Poetry to the PATH
ENV PATH="${PATH}:${POETRY_VENV}/bin"
# Set the working directory
WORKDIR /app
# Copy the project files
COPY poetry.lock pyproject.toml ./
COPY . .
# Install project dependencies
RUN poetry config virtualenvs.in-project true \
&& poetry install --no-root \
&& poetry install \
&& $POETRY_VENV/bin/pip install torch==1.13.0+cu117 -f https://download.pytorch.org/whl/torch
# Define the command to run the application
CMD gunicorn --bind 0.0.0.0:${INTERNAL_PORT:-9000} --workers 1 --timeout 0 app.webservice:app -k uvicorn.workers.UvicornWorker