Add APP_VERSION handling in Dockerfile and config.py
Updated the Dockerfile to include an ARG and ENV for APP_VERSION, allowing for version specification during build time. Modified config.py to set a default APP_VERSION, which can be overridden by the environment, enhancing flexibility for deployment and runtime configuration.
This commit is contained in:
@@ -45,6 +45,10 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Copiar código
|
||||
COPY . .
|
||||
|
||||
# Jenkins / CI pasan --build-arg APP_VERSION=…; debe quedar en ENV para runtime (API /version, OpenAPI, etc.)
|
||||
ARG APP_VERSION=dev-local
|
||||
ENV APP_VERSION=${APP_VERSION}
|
||||
|
||||
# Exponer puerto
|
||||
EXPOSE 8000
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
Configuración centralizada de la aplicación usando Pydantic Settings
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import List
|
||||
|
||||
from pydantic import field_validator
|
||||
@@ -14,9 +13,8 @@ class Settings(BaseSettings):
|
||||
|
||||
# Application
|
||||
APP_NAME: str = "Anexo76"
|
||||
# La versión se obtiene de la variable de entorno APP_VERSION que se pasa desde Docker
|
||||
# Si no existe, usa un valor por defecto de desarrollo
|
||||
APP_VERSION: str = os.getenv("APP_VERSION", "dev-local")
|
||||
# Sobreescribible con APP_VERSION (Dockerfile/Jenkins: build-arg + ENV) o entorno en runtime
|
||||
APP_VERSION: str = "dev-local"
|
||||
DEBUG: bool = True
|
||||
ENVIRONMENT: str = "development"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user