forked from ninolus/dibako_tts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (31 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
44 lines (31 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
FROM python:3.11-slim-bookworm as builder
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=true \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_CACHE_DIR=/var/cache/pypoetry \
POETRY_VERSION=2.2.1
RUN pip install poetry==$POETRY_VERSION
WORKDIR /app
COPY pyproject.toml poetry.lock /app/
RUN --mount=type=cache,target=/var/cache/pypoetry \
poetry install --no-ansi --only=main --compile
# Runtime stage
FROM python:3.11-slim-bookworm
RUN apt-get update && \
apt-get install -y espeak-ng ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN useradd -u 8877 -m containeruser && \
mkdir -p /home/containeruser/.config/pulse && \
chown -R containeruser:containeruser /home/containeruser
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PATH="/app/.venv/bin:$PATH"
COPY --from=builder /app/.venv /app/.venv
COPY app /app
RUN chown -R containeruser:containeruser /app
RUN mkdir -p /model_cache/piper && chown -R containeruser:containeruser /model_cache
USER containeruser
VOLUME ["/model_cache"]
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8004"]