forked from NikiPshg/T-one-cuda-onnx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (30 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
45 lines (30 loc) · 1.14 KB
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
FROM python:3.10 AS build
ARG POETRY_VERSION=2.1.1
RUN set -ex \
&& curl -sSL https://install.python-poetry.org -o /get-poetry.py \
&& POETRY_HOME=/opt/poetry python /get-poetry.py
ENV PATH=/opt/poetry/bin:$PATH
COPY pyproject.toml poetry.lock README.md /workspace/
COPY tone /workspace/tone
WORKDIR /workspace
RUN set -ex \
&& python -m venv /venv --without-pip \
&& . /venv/bin/activate \
&& poetry install --only main -E demo \
# Reinstall main package in non-editable mode
&& poetry build -f wheel \
&& pip --python /venv/bin/python install dist/*.whl --no-deps --force-reinstall --no-compile \
&& rm -rf ~/.cache
ENV PATH=/venv/bin:$PATH
RUN set -ex \
&& python -m tone download /models
FROM python:3.10-slim
COPY --from=build /venv /venv
COPY --from=build /models /models
ENV PATH=/venv/bin:$PATH
# Set env variable LOAD_FROM_FOLDER to load model from a local folder instead of downloading from HuggingFace
ENV LOAD_FROM_FOLDER=/models
RUN useradd -s /bin/bash python
USER python
STOPSIGNAL SIGINT
ENTRYPOINT ["uvicorn", "--host", "0.0.0.0", "--port", "8080", "--no-access-log", "tone.demo.website:app"]