add docker system
This commit is contained in:
parent
44efa841a2
commit
c0f7b030a6
11
api/Dockerfile
Normal file
11
api/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM python:3.12
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install make
|
||||||
|
COPY Makefile requirements.lock pyproject.toml README.md /src/
|
||||||
|
RUN make deps
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD make run
|
3
api/Makefile
Normal file
3
api/Makefile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
deps:
|
||||||
|
pip install uv
|
||||||
|
uv pip install --no-cache --system -r requirements.lock
|
@ -1 +1,2 @@
|
|||||||
from .check_imei import checking_router as checking_router
|
from .check_imei import checking_router as checking_router
|
||||||
|
from .healthcheck import healthcheck_router as healthcheck_router
|
8
api/src/api/healthcheck.py
Normal file
8
api/src/api/healthcheck.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from fastapi import APIRouter, status
|
||||||
|
|
||||||
|
healthcheck_router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@healthcheck_router.get("/healthcheck", status_code=status.HTTP_200_OK)
|
||||||
|
async def healthcheck():
|
||||||
|
return None
|
@ -9,7 +9,7 @@ from src.utils.exceptions import (
|
|||||||
ExternalDataValidationError
|
ExternalDataValidationError
|
||||||
)
|
)
|
||||||
|
|
||||||
from src.api import checking_router
|
from src.api import checking_router, healthcheck_router
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="hatiko-api",
|
title="hatiko-api",
|
||||||
@ -26,7 +26,7 @@ main_app_router = APIRouter(prefix="/api")
|
|||||||
|
|
||||||
main_app_router.include_router(checking_router, tags=["Check IMEI"])
|
main_app_router.include_router(checking_router, tags=["Check IMEI"])
|
||||||
|
|
||||||
|
app.include_router(healthcheck_router, tags=["Health"])
|
||||||
app.include_router(main_app_router)
|
app.include_router(main_app_router)
|
||||||
|
|
||||||
|
|
||||||
|
11
bot/Dockerfile
Normal file
11
bot/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM python:3.12
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install make
|
||||||
|
COPY Makefile requirements.lock pyproject.toml README.md /src/
|
||||||
|
RUN make deps
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD make run
|
3
bot/Makefile
Normal file
3
bot/Makefile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
deps:
|
||||||
|
pip install uv
|
||||||
|
uv pip install --no-cache --system -r requirements.lock
|
21
compose.yaml
Normal file
21
compose.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
name: hatiko
|
||||||
|
|
||||||
|
services:
|
||||||
|
api:
|
||||||
|
container_name: hatiko-api
|
||||||
|
restart: always
|
||||||
|
build: ./api
|
||||||
|
env_file: .env
|
||||||
|
healthcheck:
|
||||||
|
test: curl -sSf http://localhost:8000/healthcheck
|
||||||
|
interval: 60s
|
||||||
|
start_period: 1s
|
||||||
|
timeout: 600s
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
||||||
|
|
||||||
|
bot:
|
||||||
|
container_name: hatiko-bot
|
||||||
|
restart: always
|
||||||
|
build: ./bot
|
||||||
|
env_file: .env
|
Loading…
x
Reference in New Issue
Block a user