Summary
docker-compose-transformers.yml passes NLP_CONF_FILE only as a Docker
build-time ARG but omits it from the container's runtime environment: block.
Since app.py reads this value via os.environ.get("NLP_CONF_FILE") at
startup, the build ARG alone is not sufficient to guarantee the correct
NLP engine config is loaded at runtime — especially when the image is run
directly or in environments where build ENVs are not forwarded.
Change
Added NLP_CONF_FILE to the environment: section of presidio-analyzer
in docker-compose-transformers.yml so the build intent is explicitly
mirrored at runtime.
File changed: docker-compose-transformers.yml
environment:
- PORT=5001
+ - NLP_CONF_FILE=presidio_analyzer/conf/transformers.yaml
Why this matters
app.py reads NLP_CONF_FILE via os.environ.get() at runtime
- Without this line, the env var is absent at runtime in override/run scenarios
- Makes the config explicit and overridable without rebuilding the image
Related
Summary
docker-compose-transformers.ymlpassesNLP_CONF_FILEonly as a Dockerbuild-time ARG but omits it from the container's runtime
environment:block.Since
app.pyreads this value viaos.environ.get("NLP_CONF_FILE")atstartup, the build ARG alone is not sufficient to guarantee the correct
NLP engine config is loaded at runtime — especially when the image is run
directly or in environments where build ENVs are not forwarded.
Change
Added
NLP_CONF_FILEto theenvironment:section ofpresidio-analyzerin
docker-compose-transformers.ymlso the build intent is explicitlymirrored at runtime.
File changed:
docker-compose-transformers.ymlenvironment: - PORT=5001 + - NLP_CONF_FILE=presidio_analyzer/conf/transformers.yamlWhy this matters
app.pyreadsNLP_CONF_FILEviaos.environ.get()at runtimeRelated