|
1 | | -FROM python:3.12.13-alpine AS builder |
| 1 | +FROM python:3.12.13-slim AS builder |
| 2 | +ENV UV_PYTHON_DOWNLOADS=never |
| 3 | +ENV UV_COMPILE_BYTECODE=1 |
| 4 | +ENV PATH="/app/.venv/bin:$PATH" |
2 | 5 |
|
3 | | -RUN pip install --upgrade poetry poetry-plugin-export |
4 | | - |
5 | | -COPY python/nautobot_target_proxy/pyproject.toml \ |
6 | | - python/nautobot_target_proxy/poetry.lock \ |
7 | | - /tmp/nautobot_target_proxy/ |
8 | | - |
9 | | -RUN cd /tmp/nautobot_target_proxy && \ |
10 | | - poetry export --only main -o /tmp/requirements.txt --without-hashes |
11 | | - |
12 | | -FROM python:3.12.13-alpine AS prod |
13 | | - |
14 | | -RUN pip3 install -U pip setuptools wheel |
| 6 | +WORKDIR /app |
| 7 | +COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv |
15 | 8 |
|
16 | | -COPY --from=builder /tmp/requirements.txt /tmp/requirements.txt |
17 | | -RUN pip3 install -r /tmp/requirements.txt |
| 9 | +COPY python/nautobot_target_proxy/pyproject.toml /app/pyproject.toml |
| 10 | +COPY python/nautobot_target_proxy/uv.lock /app/uv.lock |
| 11 | +RUN --mount=type=cache,target=/root/.cache/uv \ |
| 12 | + uv sync --locked --no-dev --no-install-project |
18 | 13 |
|
19 | 14 | COPY python/nautobot_target_proxy /app |
20 | | -RUN pip3 install --no-deps /app |
| 15 | +RUN --mount=type=cache,target=/root/.cache/uv \ |
| 16 | + uv sync --locked --no-dev |
| 17 | + |
| 18 | +FROM python:3.12.13-slim AS prod |
| 19 | +ENV PATH="/app/.venv/bin:$PATH" |
21 | 20 |
|
22 | 21 | WORKDIR /app |
| 22 | +COPY --from=builder /app /app |
| 23 | + |
23 | 24 | EXPOSE 8000 |
0 commit comments