mirror of
https://github.com/kurbezz/discord-bot.git
synced 2025-12-06 07:05:36 +01:00
Move to uv
This commit is contained in:
@@ -1,33 +1,17 @@
|
||||
FROM python:3.12-slim AS build
|
||||
|
||||
ARG POETRY_EXPORT_EXTRA_ARGS=''
|
||||
|
||||
WORKDIR /opt/venv
|
||||
RUN python -m venv /opt/venv && /opt/venv/bin/pip install --upgrade pip && /opt/venv/bin/pip install --no-cache-dir httpx poetry poetry-plugin-export
|
||||
|
||||
COPY ./pyproject.toml ./poetry.lock ./
|
||||
RUN --mount=type=ssh /opt/venv/bin/poetry export --without-hashes ${POETRY_EXPORT_EXTRA_ARGS} > requirements.txt \
|
||||
&& /opt/venv/bin/pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
|
||||
FROM python:3.12-slim AS runtime
|
||||
|
||||
RUN apt update && \
|
||||
apt install -y --no-install-recommends curl jq && \
|
||||
apt clean
|
||||
|
||||
COPY ./src/ /app
|
||||
FROM ghcr.io/astral-sh/uv:python3.12-slim
|
||||
|
||||
COPY ./scripts/*.sh /
|
||||
RUN chmod +x /*.sh
|
||||
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
ENV VENV_PATH=/opt/venv
|
||||
|
||||
COPY --from=build /opt/venv /opt/venv
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./pyproject.toml ./
|
||||
COPY ./uv.lock ./
|
||||
|
||||
RUN uv env && uv sync
|
||||
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
CMD ["uv", "run", "src/main.py"]
|
||||
|
||||
Reference in New Issue
Block a user