diff --git a/api/.dockerignore b/api/.dockerignore new file mode 100644 index 0000000..e6ed9d8 --- /dev/null +++ b/api/.dockerignore @@ -0,0 +1,33 @@ +# python generated files +__pycache__/ +*.py[oc] +build/ +dist/ +wheels/ +*.egg-info + +# venv +.venv + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# ruff +.ruff_cache/ + +# rye +requirements-dev.lock + +# alembic migrations +alembic/versions + +# Docker compose +compose.yaml + +# minio +minio + +# env (pass it thru compose) +.env diff --git a/api/Dockerfile b/api/Dockerfile index 81209de..9f6edb2 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,9 +1,9 @@ FROM python:3.12 -WORKDIR /src +WORKDIR /api RUN apt-get update && apt-get install make -COPY Makefile requirements.lock pyproject.toml README.md /src/ +COPY Makefile requirements.lock pyproject.toml README.md /api/ RUN make deps COPY . . diff --git a/api/Makefile b/api/Makefile index debd2bf..bc2e415 100644 --- a/api/Makefile +++ b/api/Makefile @@ -1,3 +1,6 @@ deps: pip install uv uv pip install --no-cache --system -r requirements.lock + +run: + fastapi run src/app.py --host 0.0.0.0 diff --git a/api/src/schemas/external_checking.py b/api/src/schemas/external_checking.py index 14ca59a..914b3f6 100644 --- a/api/src/schemas/external_checking.py +++ b/api/src/schemas/external_checking.py @@ -33,8 +33,8 @@ class DeviceProperties(BaseModel): estPurchaseDate: Optional[int] = None simLock: Optional[bool] = None # parameter is exist only in documentation warrantyStatus: Optional[str] = None - repairCoverage: Union[bool, str] # I got bool, in documentation - str - technicalSupport: Union[bool, str] # I got bool, in documentation - str + repairCoverage: Union[bool, str, None] = None # I got bool, in documentation - str + technicalSupport: Union[bool, str, None] = None # I got bool, in documentation - str replacement: Optional[bool] = None # parameter isn't exist in documentation demoUnit: Optional[bool] = None refurbished: Optional[bool] = None diff --git a/bot/.dockerignore b/bot/.dockerignore new file mode 100644 index 0000000..e6ed9d8 --- /dev/null +++ b/bot/.dockerignore @@ -0,0 +1,33 @@ +# python generated files +__pycache__/ +*.py[oc] +build/ +dist/ +wheels/ +*.egg-info + +# venv +.venv + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# ruff +.ruff_cache/ + +# rye +requirements-dev.lock + +# alembic migrations +alembic/versions + +# Docker compose +compose.yaml + +# minio +minio + +# env (pass it thru compose) +.env diff --git a/bot/Dockerfile b/bot/Dockerfile index 81209de..dd77b0d 100644 --- a/bot/Dockerfile +++ b/bot/Dockerfile @@ -1,9 +1,9 @@ FROM python:3.12 -WORKDIR /src +WORKDIR /bot RUN apt-get update && apt-get install make -COPY Makefile requirements.lock pyproject.toml README.md /src/ +COPY Makefile requirements.lock pyproject.toml README.md /bot/ RUN make deps COPY . . diff --git a/bot/Makefile b/bot/Makefile index debd2bf..45a0da7 100644 --- a/bot/Makefile +++ b/bot/Makefile @@ -1,3 +1,6 @@ deps: pip install uv uv pip install --no-cache --system -r requirements.lock + +run: + python main.py diff --git a/bot/src/main.py b/bot/main.py similarity index 100% rename from bot/src/main.py rename to bot/main.py diff --git a/bot/pyproject.toml b/bot/pyproject.toml index b12f916..15c106f 100644 --- a/bot/pyproject.toml +++ b/bot/pyproject.toml @@ -13,7 +13,7 @@ dependencies = [ "requests>=2.32.3", ] readme = "README.md" -requires-python = ">= 3.8" +requires-python = ">= 3.12" [build-system] requires = ["hatchling"] @@ -27,4 +27,4 @@ dev-dependencies = [] allow-direct-references = true [tool.hatch.build.targets.wheel] -packages = ["src"] +packages = ["src/bot"] diff --git a/compose.yaml b/compose.yaml index a1f0a47..f36f1c5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,7 +12,7 @@ services: start_period: 1s timeout: 600s ports: - - 8000:8000 + - 8005:8000 bot: container_name: hatiko-bot