-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.processor
39 lines (31 loc) · 1.23 KB
/
Dockerfile.processor
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
FROM python:3.12-slim-bullseye AS final
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
ENV UV_PYTHON_DOWNLOADS=never
# Location of the virtual environment
ENV UV_PROJECT_ENVIRONMENT="/venv"
# Location of the python installation via uv
ENV UV_PYTHON_INSTALL_DIR="/python"
# Byte compile the python files on installation
ENV UV_COMPILE_BYTECODE=1
# Python verision to use
ENV UV_PYTHON=python3.12
# Tweaking the PATH variable for easier use
ENV PATH="$UV_PROJECT_ENVIRONMENT/bin:$PATH"
WORKDIR /app
# Install minimal required dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies using uv
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project --no-editable
# Copy only necessary files
COPY src/processor/ /app/code/
COPY src/configs/processor_config.py /app/code/configs/
COPY src/payload/processor_models.py /app/code/payload/
COPY src/payload/shared_models.py /app/code/payload/
WORKDIR /app/code/
CMD ["uv", "run", "uvicorn", "processor:app", "--host", "0.0.0.0", "--port", "9090"]