-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: restructuring, implementation of rye dependency manager, Docke…
…rfile improvement
- Loading branch information
Showing
12 changed files
with
240 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
FROM python:3.9-slim as base | ||
FROM python:3.12.2-slim-bookworm as base | ||
LABEL org.opencontainers.image.authors="MrPandir <MrPandir@users.noreply.github.com>" | ||
LABEL org.opencontainers.image.source="https://github.com/twirapp/silero-tts-api-server" | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
LABEL org.opencontainers.image.title="Silero TTS API server" | ||
LABEL org.opencontainers.image.description="This is a simple server that uses Silero models to convert text to audio files over HTTP" | ||
LABEL org.opencontainers.image.vendor="TwirApp" | ||
|
||
FROM base as pip-installer | ||
WORKDIR /app | ||
COPY requirements.txt requirements.txt | ||
RUN pip3 install -r requirements.txt --user --no-cache-dir --no-warn-script-location | ||
FROM base as dependencies-installer | ||
SHELL ["/bin/bash", "-c"] | ||
RUN apt-get -y update && apt-get -y install curl && \ | ||
apt-get autoremove && apt-get clean | ||
RUN curl -sSf https://rye-up.com/get | NO_AUTO_INSTALL=1 RYE_INSTALL_OPTION="--yes" RYE_TOOLCHAIN=/usr/local/bin/python3 bash && \ | ||
bash -c "source $HOME/.rye/env && rye pin 3.12.2" | ||
ENV PATH=/root/.rye/shims:$PATH | ||
COPY pyproject.toml requirements.lock /app/ | ||
RUN --mount=type=cache,target=/root/.cache rye sync --pyproject /app/pyproject.toml --no-dev --no-lock | ||
|
||
FROM base as models-installer | ||
WORKDIR /app | ||
RUN apt-get update && apt-get install -y curl | ||
RUN apt-get -y update && apt-get -y install curl | ||
COPY models models | ||
COPY install_models.sh install_models.sh | ||
RUN chmod -x install_models.sh && bash ./install_models.sh >&2 | ||
|
||
|
||
FROM base | ||
LABEL org.opencontainers.image.authors="MrPandir <MrPandir@users.noreply.github.com>" | ||
LABEL org.opencontainers.image.source="https://github.com/twirapp/silero-tts-api-server" | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
LABEL org.opencontainers.image.title="Silero TTS API server" | ||
LABEL org.opencontainers.image.description="This is a simple server that uses Silero models to convert text to audio files over HTTP" | ||
LABEL org.opencontainers.image.vendor="TwirApp" | ||
WORKDIR /app | ||
|
||
COPY . /app | ||
COPY --from=models-installer /app/models /app/models | ||
COPY --from=pip-installer /root/.local /root/.local | ||
ENV PATH=/root/.local/bin:$PATH | ||
|
||
COPY --from=models-installer /models /app/models | ||
COPY --from=dependencies-installer /app/.venv .venv | ||
ENV PATH=/app/.venv/bin:$PATH | ||
COPY /app ./app | ||
COPY /tts ./tts | ||
CMD ["litestar", "run", "--host", "0.0.0.0", "--port", "8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.* | ||
docker/ | ||
|
||
__pycache__ | ||
**/__pycache__ | ||
venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[project] | ||
name = "silero-tts-api-server" | ||
version = "1.0.0" | ||
description = "This is a simple server that uses Silero models to convert text to audio files over HTTP" | ||
authors = [ | ||
{ name = "MrPandir", email = "MrPandir@users.noreply.github.com" } | ||
] | ||
dependencies = [ | ||
"uvicorn>=0.27.1", | ||
"litestar>=2.6.1", | ||
"torch>=2.2.0", | ||
"numpy>=1.26.4", | ||
"python-dotenv>=1.0.1", | ||
] | ||
requires-python = ">=3.9" | ||
|
||
[tool.rye] | ||
managed = true | ||
dev-dependencies = [] | ||
excluded-dependencies = [ | ||
"polyfactory", | ||
"faker", | ||
"six", | ||
"filelock", | ||
"fsspec", | ||
"jinja2", | ||
"markupsafe", | ||
"mpmath", | ||
"networkx", | ||
"sympy", | ||
] | ||
|
||
[[tool.rye.sources]] | ||
name = "pytorch" | ||
url = "https://download.pytorch.org/whl/cpu" | ||
|
||
[tool.hatch.metadata] | ||
allow-direct-references = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# generated by rye | ||
# use `rye lock` or `rye sync` to update this lockfile | ||
# | ||
# last locked with the following flags: | ||
# pre: false | ||
# features: [] | ||
# all-features: false | ||
# with-sources: false | ||
|
||
-e file:. | ||
anyio==4.2.0 | ||
# via httpx | ||
# via litestar | ||
certifi==2024.2.2 | ||
# via httpcore | ||
# via httpx | ||
click==8.1.7 | ||
# via litestar | ||
# via rich-click | ||
# via uvicorn | ||
# faker==23.2.1 (excluded) | ||
# via polyfactory | ||
# filelock==3.13.1 (excluded) | ||
# via torch | ||
# fsspec==2024.2.0 (excluded) | ||
# via torch | ||
h11==0.14.0 | ||
# via httpcore | ||
# via uvicorn | ||
httpcore==1.0.3 | ||
# via httpx | ||
httpx==0.26.0 | ||
# via litestar | ||
idna==3.6 | ||
# via anyio | ||
# via httpx | ||
# jinja2==3.1.3 (excluded) | ||
# via torch | ||
litestar==2.6.1 | ||
# via silero-tts-api-server | ||
markdown-it-py==3.0.0 | ||
# via rich | ||
# markupsafe==2.1.5 (excluded) | ||
# via jinja2 | ||
mdurl==0.1.2 | ||
# via markdown-it-py | ||
# mpmath==1.3.0 (excluded) | ||
# via sympy | ||
msgspec==0.18.6 | ||
# via litestar | ||
multidict==6.0.5 | ||
# via litestar | ||
# networkx==3.2.1 (excluded) | ||
# via torch | ||
numpy==1.26.4 | ||
# via silero-tts-api-server | ||
# polyfactory==2.14.1 (excluded) | ||
# via litestar | ||
pygments==2.17.2 | ||
# via rich | ||
python-dateutil==2.8.2 | ||
# via faker | ||
python-dotenv==1.0.1 | ||
# via silero-tts-api-server | ||
pyyaml==6.0.1 | ||
# via litestar | ||
rich==13.7.0 | ||
# via litestar | ||
# via rich-click | ||
rich-click==1.7.3 | ||
# via litestar | ||
# six==1.16.0 (excluded) | ||
# via python-dateutil | ||
sniffio==1.3.0 | ||
# via anyio | ||
# via httpx | ||
# sympy==1.12 (excluded) | ||
# via torch | ||
torch==2.2.0 | ||
# via silero-tts-api-server | ||
typing-extensions==4.9.0 | ||
# via litestar | ||
# via polyfactory | ||
# via rich-click | ||
# via torch | ||
uvicorn==0.27.1 | ||
# via silero-tts-api-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# generated by rye | ||
# use `rye lock` or `rye sync` to update this lockfile | ||
# | ||
# last locked with the following flags: | ||
# pre: false | ||
# features: [] | ||
# all-features: false | ||
# with-sources: false | ||
|
||
-e file:. | ||
anyio==4.2.0 | ||
# via httpx | ||
# via litestar | ||
certifi==2024.2.2 | ||
# via httpcore | ||
# via httpx | ||
click==8.1.7 | ||
# via litestar | ||
# via rich-click | ||
# via uvicorn | ||
# faker==23.2.1 (excluded) | ||
# via polyfactory | ||
# filelock==3.13.1 (excluded) | ||
# via torch | ||
# fsspec==2024.2.0 (excluded) | ||
# via torch | ||
h11==0.14.0 | ||
# via httpcore | ||
# via uvicorn | ||
httpcore==1.0.3 | ||
# via httpx | ||
httpx==0.26.0 | ||
# via litestar | ||
idna==3.6 | ||
# via anyio | ||
# via httpx | ||
# jinja2==3.1.3 (excluded) | ||
# via torch | ||
litestar==2.6.1 | ||
# via silero-tts-api-server | ||
markdown-it-py==3.0.0 | ||
# via rich | ||
# markupsafe==2.1.5 (excluded) | ||
# via jinja2 | ||
mdurl==0.1.2 | ||
# via markdown-it-py | ||
# mpmath==1.3.0 (excluded) | ||
# via sympy | ||
msgspec==0.18.6 | ||
# via litestar | ||
multidict==6.0.5 | ||
# via litestar | ||
# networkx==3.2.1 (excluded) | ||
# via torch | ||
numpy==1.26.4 | ||
# via silero-tts-api-server | ||
# polyfactory==2.14.1 (excluded) | ||
# via litestar | ||
pygments==2.17.2 | ||
# via rich | ||
python-dateutil==2.8.2 | ||
# via faker | ||
python-dotenv==1.0.1 | ||
# via silero-tts-api-server | ||
pyyaml==6.0.1 | ||
# via litestar | ||
rich==13.7.0 | ||
# via litestar | ||
# via rich-click | ||
rich-click==1.7.3 | ||
# via litestar | ||
# six==1.16.0 (excluded) | ||
# via python-dateutil | ||
sniffio==1.3.0 | ||
# via anyio | ||
# via httpx | ||
# sympy==1.12 (excluded) | ||
# via torch | ||
torch==2.2.0 | ||
# via silero-tts-api-server | ||
typing-extensions==4.9.0 | ||
# via litestar | ||
# via polyfactory | ||
# via rich-click | ||
# via torch | ||
uvicorn==0.27.1 | ||
# via silero-tts-api-server |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.