Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy

COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-install-project
RUN uv sync --frozen --no-install-project --no-dev

COPY app/ ./app/
COPY tests/ ./tests/

# ── Stage 2: runtime ──────────────────────────────────────────────────────────
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS runtime
Expand All @@ -27,13 +26,12 @@ RUN useradd --system --create-home --uid 1001 appuser \

WORKDIR /app

COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app/app /app/app
COPY --from=builder /app/pyproject.toml /app/pyproject.toml
COPY scripts/entrypoint.sh /app/scripts/entrypoint.sh
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
COPY --from=builder --chown=appuser:appuser /app/app /app/app
COPY --from=builder --chown=appuser:appuser /app/pyproject.toml /app/pyproject.toml
COPY --chown=appuser:appuser scripts/entrypoint.sh /app/scripts/entrypoint.sh

RUN chmod +x /app/scripts/entrypoint.sh \
&& chown -R appuser:appuser /app
RUN chmod +x /app/scripts/entrypoint.sh

# HF_HOME=/weights — pocket-tts downloads models here (persisted via named volume)
ENV PATH="/app/.venv/bin:$PATH" \
Expand Down
6 changes: 4 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ def create_app() -> FastAPI:
)

if settings.app_env == "production":
app.add_middleware(TrustedHostMiddleware, allowed_hosts=[settings.domain])

app.add_middleware(
TrustedHostMiddleware,
allowed_hosts=[settings.domain, "localhost", "127.0.0.1"],
)
app.add_middleware(RequestLoggingMiddleware)
register_error_handlers(app)

Expand Down
Loading