diff --git a/Dockerfile b/Dockerfile index 8112059..85cab20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,6 @@ # Multi-stage build for database schema spec generator # Stage 1: Build the schemas -FROM alpine:3.22.1 AS builder - -# Install Python, uv, and git (needed for some dependencies) -RUN apk add --no-cache python3 py3-pip git - -# Install uv package manager -RUN pip3 install --break-system-packages uv +FROM ghcr.io/astral-sh/uv:0.8.13-alpine3.22 AS builder # Set working directory WORKDIR /app @@ -27,7 +21,7 @@ COPY .env ./ RUN uv run python main.py # Stage 2: Final lightweight image with only the output -FROM alpine:3.22.1 +FROM alpine:3.22 AS final # Create output directory RUN mkdir -p /output diff --git a/database_schema_spec/core/config.py b/database_schema_spec/core/config.py index b131f4d..3978fff 100644 --- a/database_schema_spec/core/config.py +++ b/database_schema_spec/core/config.py @@ -1,9 +1,7 @@ """Configuration constants for the database schema spec generator.""" -import os from pathlib import Path -from dotenv import load_dotenv from pydantic import BaseModel, Field, ValidationError from pydantic_settings import BaseSettings @@ -67,12 +65,6 @@ class Config(BaseSettings): def __init__(self, **data): """Initialize config with custom error handling for missing required fields.""" try: - # Enforce presence of required env variables in the process environment - # before delegating to BaseSettings. This ensures tests that clear os.environ - # see the expected ConfigurationError. - if "base_url" not in data and "BASE_URL" not in os.environ: - raise ConfigurationError(variable_name="BASE_URL") - super().__init__(**data) except ValidationError as e: # Only handle missing field errors, let other validation errors bubble up @@ -88,6 +80,4 @@ def __init__(self, **data): raise -# At application import time, populate os.environ from .env (if present), then enforce presence. -load_dotenv(override=True) config = Config() diff --git a/pyproject.toml b/pyproject.toml index 04268c8..ecdcacf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,6 @@ dependencies = [ "jsonschema>=4.25.0", "pydantic>=2.11.7", "pydantic-settings>=2.10.1", - "python-dotenv>=1.1.1", ] [dependency-groups] diff --git a/uv.lock b/uv.lock index 0b2c531..4110c67 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.13" [[package]] @@ -99,7 +99,6 @@ dependencies = [ { name = "jsonschema" }, { name = "pydantic" }, { name = "pydantic-settings" }, - { name = "python-dotenv" }, ] [package.dev-dependencies] @@ -117,7 +116,6 @@ requires-dist = [ { name = "jsonschema", specifier = ">=4.25.0" }, { name = "pydantic", specifier = ">=2.11.7" }, { name = "pydantic-settings", specifier = ">=2.10.1" }, - { name = "python-dotenv", specifier = ">=1.1.1" }, ] [package.metadata.requires-dev]