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
.gitignore
.gitattributes
# ============================================================================
# WHITELIST APPROACH: Block everything by default, then allow only what's needed
# ============================================================================
# Documentation
*.md
docs/
README*
# Block everything first
*
# Tests and development
tests/
.pytest_cache/
.coverage
htmlcov/
.tox/
.nox/
.mypy_cache/
.pyre/
coverage.xml
*.cover
.hypothesis/
# ============================================================================
# ALLOW: Application source code (model_manager package)
# ============================================================================
# Allow the main package directory and all Python files
!model_manager/
!model_manager/**/*.py
!model_manager/**/__init__.py
# Allow subdirectories structure
!model_manager/activities/
!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
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
**/__pycache__/
**/*.pyc
**/*.pyo
**/*.pyd
**/.Python
**/*.so
**/*.egg
**/*.egg-info/
# Virtual environments
venv/
env/
ENV/
.venv/
.env/
# Tests (not needed in production)
model_manager/**/test_*.py
model_manager/**/*_test.py
# IDE and editors
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
Thumbs.db
# IDE and editor files
**/.vscode/
**/.idea/
**/*.swp
**/*.swo
**/*~
# OS files
.dockerignore
.dockerignore.dockerignore
**/.DS_Store
**/Thumbs.db
# CI/CD
.github/
.gitlab-ci.yml
.travis.yml
.circleci/
Jenkinsfile
# Logs and temporary files
**/*.log
**/*.tmp
**/*.temp
# Local configuration
.env
.env.local
.env.*.local
config/local/
*.local
**/.env
**/.env.local
**/*.local
# Logs
*.log
logs/
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
# Documentation inside code
**/*.md
**/README*
# Backup files
*.bak
*.backup
*.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/
**/*.bak
**/*.backup
**/*.old

View File

@@ -373,7 +373,11 @@ async def test_main_temporal_client_configuration(
with patch.dict(
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
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.
- Atualizar a documentação dos métodos alterados.
- Atualizar a documentação do projeto.

View File

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