29 lines
666 B
Docker
29 lines
666 B
Docker
FROM ghcr.io/astral-sh/uv:0.9-python3.12-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apk update \
|
|
&& apk add gcc python3-dev musl-dev linux-headers
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
uv sync --no-install-workspace
|
|
|
|
ADD . /app
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --locked
|
|
|
|
FROM python:3.12-alpine3.22
|
|
|
|
RUN apk update --no-cache \
|
|
&& apk add --no-cache git
|
|
|
|
COPY --from=builder --chown=app:app /app/.venv /app/.venv
|
|
COPY --from=builder --chown=app:app /app/app /app/app
|
|
|
|
ENV PYTHONPATH="/app"
|
|
|
|
ENTRYPOINT ["app/.venv/bin/python"]
|
|
|
|
CMD ["/app/app/main.py"]
|