diff --git a/.python-version b/.python-version index 6324d40..e4fba21 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.14 +3.12 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6ef7b5f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +services: + backend: + image: python:3.12-alpine + container_name: uvpn-backend + working_dir: /app + volumes: + - ./backend:/app + - /app/.venv + environment: + - UV_COMPILE_BYTECODE=1 + - UV_LINK_MODE=copy + expose: + - 8000 + command: > + sh -c "pip install --no-cache-dir uv && + uv sync --frozen && + fastapi run" + networks: + - remnawave-network + restart: always + +networks: + remnawave-network: + external: true \ No newline at end of file diff --git a/main.py b/main.py index 297a289..b42d87d 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,5 @@ from fastapi import FastAPI import tomllib -import uvicorn from .routers import ip @@ -15,6 +14,4 @@ app = FastAPI( version=get_version_from_pyproject() ) -app.include_router(ip.router) - -uvicorn.run(app, host='0.0.0.0', port=8443) \ No newline at end of file +app.include_router(ip.router) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index cc5377d..afd2f3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "uvpn-backend" version = "0.1.0" description = "Add your description here" readme = "README.md" -requires-python = ">=3.14" +requires-python = ">=3.12" dependencies = [ "bs4>=0.0.2", "fastapi[standard]>=0.136.3", diff --git a/routers/ip.py b/routers/ip.py index 6095337..73d7e63 100644 --- a/routers/ip.py +++ b/routers/ip.py @@ -151,7 +151,7 @@ class IPInfo: # ==================== Роутер ==================== -router = APIRouter(prefix='api/v1', tags=['ip']) +router = APIRouter(prefix='/api/v1', tags=['ip']) @router.get('/ip', response_model=IPInfoModel) async def get_ip(request: Request):