Emit correlated JSON logs from the API and FunASR services, propagate request IDs to the client, and configure bounded opt-in Docker logging. Document the host-wide Grafana/Loki query workflow and keep observability deployment ownership outside the application repository.
31 lines
972 B
Docker
31 lines
972 B
Docker
FROM python:3.10-slim
|
|
|
|
ARG DEBIAN_MIRROR=http://deb.debian.org
|
|
ARG PYPI_INDEX_URL=https://pypi.org/simple
|
|
ARG APP_VERSION=0.2.0
|
|
ARG GIT_SHA=unknown
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
APP_ENV=lan \
|
|
APP_VERSION=${APP_VERSION} \
|
|
GIT_SHA=${GIT_SHA} \
|
|
LOG_FORMAT=json
|
|
|
|
RUN sed -i "s|http://deb.debian.org|${DEBIAN_MIRROR}|g" /etc/apt/sources.list.d/debian.sources \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends ffmpeg libsndfile1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt ./
|
|
RUN pip install --index-url "${PYPI_INDEX_URL}" --upgrade pip
|
|
RUN pip install torch==2.8.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cpu
|
|
RUN pip install --index-url "${PYPI_INDEX_URL}" -r requirements.txt
|
|
|
|
COPY app.py logging_config.py ./
|
|
|
|
EXPOSE 10095
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "10095", "--workers", "1", "--no-access-log"]
|