SIENTIAPDE-1350: Improve Docker image build context and fix queue names

This commit refactors the .dockerignore file to use a whitelist approach, significantly reducing the Docker image size by excluding unnecessary files. It also fixes the queue names in values.yaml and adds TEMPORAL_USE_TLS to the test environment.
This commit is contained in:
Bruno Domingues
2025-11-26 17:52:44 -03:00
parent c281969381
commit 11aaa0780f
4 changed files with 86 additions and 215 deletions

View File

@@ -1,225 +1,93 @@
# Git # ============================================================================
.git # WHITELIST APPROACH: Block everything by default, then allow only what's needed
.gitignore # ============================================================================
.gitattributes
# Documentation # Block everything first
*.md *
docs/
README*
# Tests and development # ============================================================================
tests/ # ALLOW: Application source code (model_manager package)
.pytest_cache/ # ============================================================================
.coverage
htmlcov/ # Allow the main package directory and all Python files
.tox/ !model_manager/
.nox/ !model_manager/**/*.py
.mypy_cache/ !model_manager/**/__init__.py
.pyre/
coverage.xml # Allow subdirectories structure
*.cover !model_manager/activities/
.hypothesis/ !model_manager/activities/**
!model_manager/schedules/
!model_manager/schedules/**
!model_manager/sientia/
!model_manager/sientia/**
!model_manager/utils/
!model_manager/utils/**
!model_manager/utils/models/
!model_manager/utils/models/**
!model_manager/utils/repository/
!model_manager/utils/repository/**
!model_manager/worker/
!model_manager/worker/**
!model_manager/workflows/
!model_manager/workflows/**
# Allow reports directory with header.html
!model_manager/reports/
!model_manager/reports/header.html
# Allow temp directory structure (but not its contents)
!model_manager/reports/temp/
# ============================================================================
# ALLOW: Dependencies file (needed for pip install in Dockerfile)
# ============================================================================
!requirements.txt
# ============================================================================
# BLOCK: Explicitly block unwanted files even if they match above patterns
# ============================================================================
# Python cache and compiled files # Python cache and compiled files
__pycache__/ **/__pycache__/
*.py[cod] **/*.pyc
*$py.class **/*.pyo
*.so **/*.pyd
.Python **/.Python
build/ **/*.so
develop-eggs/ **/*.egg
dist/ **/*.egg-info/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# Virtual environments # Tests (not needed in production)
venv/ model_manager/**/test_*.py
env/ model_manager/**/*_test.py
ENV/
.venv/
.env/
# IDE and editors # IDE and editor files
.vscode/ **/.vscode/
.idea/ **/.idea/
*.swp **/*.swp
*.swo **/*.swo
*~ **/*~
.DS_Store
Thumbs.db
# OS files # OS files
.dockerignore **/.DS_Store
.dockerignore.dockerignore **/Thumbs.db
# CI/CD # Logs and temporary files
.github/ **/*.log
.gitlab-ci.yml **/*.tmp
.travis.yml **/*.temp
.circleci/
Jenkinsfile
# Local configuration # Local configuration
.env **/.env
.env.local **/.env.local
.env.*.local **/*.local
config/local/
*.local
# Logs # Documentation inside code
*.log **/*.md
logs/ **/README*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids/
*.pid
*.seed
*.pid.lock
# Temporary files
tmp/
temp/
*.tmp
*.temp
# Node.js (if any frontend tools)
node_modules/
npm-debug.log*
# Database
*.db
*.sqlite
*.sqlite3
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# pipenv
Pipfile.lock
# PEP 582
__pypackages__/
# Celery
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# Backup files # Backup files
*.bak **/*.bak
*.backup **/*.backup
*.old **/*.old
# Local development scripts
scripts/local/
dev-*
# Docker files (excluding the main ones)
docker-compose*.yml
docker-compose*.yaml
Dockerfile.*
!Dockerfile
# Helm charts (already in .gitignore but reinforcing)
charts/
# Kubernetes manifests
k8s/
kube-*
# Terraform
*.tfstate
*.tfstate.*
.terraform/
# Monitoring and profiling
*.prof
*.profile
.perf
# Security
*.pem
*.key
*.crt
*.p12
secrets/
*.secret
# Large binaries and datasets
*.bin
*.pkl
*.pickle
*.joblib
data/
datasets/
models/pre-trained/
# Build artifacts
build/
dist/
target/
out/
# Package manager lock files (keeping requirements.txt)
package-lock.json
yarn.lock
Pipfile.lock
# Local tools
tools/local/
bin/local/
# Cache directories
.cache/
cache/
# Development and configuration files
.env.example
requirements-dev.txt
pyproject.toml
sonar-project.properties
todo-list.txt
validate.sh
run_local.sh
LICENSE
# Helm charts (development only)
sientia-module/
*.yaml
# Local directories
data/
logs/
models/
temp/
scripts/

View File

@@ -373,7 +373,11 @@ async def test_main_temporal_client_configuration(
with patch.dict( with patch.dict(
os.environ, os.environ,
{'TEMPORAL_HOST': 'temporal.example.com:7233', 'TEMPORAL_NAMESPACE': 'production'}, {
'TEMPORAL_HOST': 'temporal.example.com:7233',
'TEMPORAL_NAMESPACE': 'production',
'TEMPORAL_USE_TLS': 'true',
},
): ):
# Setup mocks # Setup mocks
mock_get_logger.return_value = mock_logger mock_get_logger.return_value = mock_logger

View File

@@ -1,4 +1,3 @@
- Refatorar o arquivo .dockerignore para só deixar copiar os arquivos que forem necessários para a execução do container, pois ele está copiando muitos arquivos desnecessários.
- Criar um gráfico no grafana para cada nova atividade. - Criar um gráfico no grafana para cada nova atividade.
- Atualizar a documentação dos métodos alterados. - Atualizar a documentação dos métodos alterados.
- Atualizar a documentação do projeto. - Atualizar a documentação do projeto.

View File

@@ -188,9 +188,9 @@ env:
- name: TEMPORAL_NAMESPACE - name: TEMPORAL_NAMESPACE
value: "model-manager" value: "model-manager"
- name: TRAIN_TASK_QUEUE - name: TRAIN_TASK_QUEUE
value: "train_model_queue" value: "train_model-queue"
- name: CLEANUP_TASK_QUEUE - name: CLEANUP_TASK_QUEUE
value: "cleanup_queue" value: "cleanup-queue"
- name: TEMPORAL_USE_TLS - name: TEMPORAL_USE_TLS
value: "false" value: "false"