Move to uv

This commit is contained in:
2025-02-19 15:55:49 +01:00
parent 5648bfa024
commit f907892769
5 changed files with 1236 additions and 2200 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,4 @@
venv
.venv
.DS_Store

View File

@@ -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"]

2152
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,30 +1,34 @@
[tool.poetry]
[project]
name = "discord-bot"
version = "0.1.0"
description = ""
authors = ["Bulat Kurbanov <kurbanovbul@gmail.com>"]
authors = [{ name = "Bulat Kurbanov", email = "kurbanovbul@gmail.com" }]
requires-python = "~=3.12"
readme = "README.md"
packages = [{include = "discord_bot"}]
dependencies = [
"discord-py>=2.4.0,<3",
"twitchapi>=4.4.0,<5",
"pydantic>=2.10.5,<3",
"pydantic-settings>=2.7.1,<3",
"httpx>=0.28.1,<0.29",
"icalendar>=6.1.0,<7",
"pytz~=2024.2",
"mongojet>=0.2.7,<0.3",
"taskiq>=0.11.11,<0.12",
"taskiq-redis>=1.0.2,<2",
"redis[hiredis]>=5.2.1,<6",
"fastapi>=0.115.8,<0.116",
"authx>=1.4.1,<2",
"httpx-oauth>=0.16.1,<0.17",
"uvicorn[standard]>=0.34.0,<0.35",
]
[tool.poetry.dependencies]
python = "^3.11"
discord-py = "^2.4.0"
twitchapi = "^4.4.0"
pydantic = "^2.10.5"
pydantic-settings = "^2.7.1"
httpx = "^0.28.1"
icalendar = "^6.1.0"
pytz = "^2024.2"
mongojet = "^0.2.7"
taskiq = "^0.11.11"
taskiq-redis = "^1.0.2"
redis = {extras = ["hiredis"], version = "^5.2.1"}
fastapi = "^0.115.8"
authx = "^1.4.1"
httpx-oauth = "^0.16.1"
uvicorn = {extras = ["standard"], version = "^0.34.0"}
[tool.hatch.build.targets.sdist]
include = ["discord_bot"]
[tool.hatch.build.targets.wheel]
include = ["discord_bot"]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

1200
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff