mirror of
https://github.com/ferdzo/iotDashboard.git
synced 2026-04-05 17:16:26 +00:00
Add Dockerfile and .dockerignore; refactor import paths in app modules
This commit is contained in:
9
services/device_manager/.dockerignore
Normal file
9
services/device_manager/.dockerignore
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
.env
|
||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
*.crl
|
||||||
|
*.crt
|
||||||
|
*.pem
|
||||||
11
services/device_manager/Dockerfile
Normal file
11
services/device_manager/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FROM ghcr.io/astral-sh/uv:python3.13-alpine
|
||||||
|
|
||||||
|
COPY ./pyproject.toml ./
|
||||||
|
|
||||||
|
COPY ./uv.lock ./
|
||||||
|
|
||||||
|
RUN uv sync
|
||||||
|
|
||||||
|
COPY ./app/ ./app/
|
||||||
|
|
||||||
|
ENTRYPOINT [ "uv", "run", "uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "8000" ]
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from db_models import Device, DeviceCertificate # SQLAlchemy ORM models
|
|
||||||
from fastapi import FastAPI, HTTPException
|
from fastapi import FastAPI, HTTPException
|
||||||
|
|
||||||
from cert_manager import CertificateManager
|
from app.cert_manager import CertificateManager
|
||||||
from database import get_db_context
|
from app.database import get_db_context
|
||||||
from models import DeviceRegistrationRequest, DeviceRegistrationResponse, DeviceResponse
|
from app.db_models import Device, DeviceCertificate # SQLAlchemy ORM models
|
||||||
|
from app.models import DeviceRegistrationRequest, DeviceRegistrationResponse, DeviceResponse
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ from cryptography.hazmat.primitives.asymmetric import rsa
|
|||||||
from cryptography.x509.oid import NameOID
|
from cryptography.x509.oid import NameOID
|
||||||
from nanoid import generate
|
from nanoid import generate
|
||||||
|
|
||||||
from config import config
|
from app.config import config
|
||||||
from models import DeviceRegistrationResponse
|
from app.models import DeviceRegistrationResponse
|
||||||
|
|
||||||
lowercase_numbers = "abcdefghijklmnopqrstuvwxyz0123456789"
|
lowercase_numbers = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from contextlib import contextmanager
|
|||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import Session, sessionmaker
|
from sqlalchemy.orm import Session, sessionmaker
|
||||||
|
|
||||||
from config import config
|
from app.config import config
|
||||||
|
|
||||||
# Create engine with connection pooling
|
# Create engine with connection pooling
|
||||||
engine = create_engine(
|
engine = create_engine(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import datetime
|
|||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class DeviceRegistrationRequest(BaseModel):
|
class DeviceRegistrationRequest(BaseModel):
|
||||||
"""Request model for registering a new device."""
|
"""Request model for registering a new device."""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user