940ed22a6044c80abb1bf479a394d8dad7d99e6e
All checks were successful
Release / release (push) Successful in 2m55s
ci-image: MAVEN settings handling
This image supports injecting a Maven settings.xml at container start via environment variables.
Environment variables
MAVEN_SETTINGS_BASE64(preferred): base64-encoded contents of thesettings.xml. If present, the entrypoint will decode it and write it to~/.m2/settings.xml.MAVEN_SETTINGS: raw contents of thesettings.xml. Used only ifMAVEN_SETTINGS_BASE64is not set.
Notes
- The entrypoint will create
~/.m2if it does not exist and set thesettings.xmlfile to mode644. - Use
MAVEN_SETTINGS_BASE64when your CI system has trouble preserving newlines or special characters in environment variables.
Examples
Build the image:
docker build -t my-ci-image .
Provide raw settings (works if your CI preserves newlines):
docker run --rm -e MAVEN_SETTINGS="$(cat ~/.m2/settings.xml)" my-ci-image bash -lc 'cat ~/.m2/settings.xml'
Provide base64-encoded settings (recommended to avoid newline issues):
docker run --rm -e MAVEN_SETTINGS_BASE64="$(base64 -w0 ~/.m2/settings.xml)" my-ci-image bash -lc 'cat ~/.m2/settings.xml'
GitHub Actions (example)
If you store the plain settings.xml as a secret, encode it before setting a secret value (locally):
# encode locally then paste into GitHub secret value
base64 -w0 ~/.m2/settings.xml
Then in your workflow use the secret as-is:
env:
MAVEN_SETTINGS_BASE64: ${{ secrets.MAVEN_SETTINGS_BASE64 }}
uses: docker://my-ci-image
If your CI runner can pass multiline env vars safely, you can instead set MAVEN_SETTINGS to the raw XML.
Description
1.2.0
Latest
Languages
Shell
50.6%
Dockerfile
49.4%