-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
39 lines (31 loc) · 997 Bytes
/
Dockerfile.api
File metadata and controls
39 lines (31 loc) · 997 Bytes
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
# ---- Stage 1: Build layer with uv ----
FROM ghcr.io/astral-sh/uv:0.4.20 AS uv
# ---- Stage 2: Application image ----
FROM python:3.14.1-slim
# Copy in `uv` binary
COPY --from=uv /uv /bin/uv
ENV UV_SYSTEM_PYTHON=1
# Install networking tools (ping, netcat, dig) and ffmpeg (audio chunking)
RUN apt-get update && apt-get install -y --no-install-recommends \
inetutils-ping \
netcat-traditional \
dnsutils \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Install the requirements using uv
WORKDIR /app
COPY pyproject.toml uv.lock* ./
RUN uv pip compile pyproject.toml -o requirements.txt
RUN uv pip install -U -r requirements.txt \
&& rm requirements.txt
# Create a non-root user
RUN useradd -m app_user
# Create working directories and set permissions
RUN mkdir -p /app && \
chown -R app_user:app_user /app
COPY --chown=app_user:app_user src/ /app/src/
# Change user and working directory
USER app_user
WORKDIR /app/src
# Update Python Path
ENV PYTHONPATH="/app/src"