Docker Build System
A simple library for handling docker commands with python.
Install Or Upgrade
- pip install --upgrade DockerBuildSystem
Example
- Include DockerBuildSystem tools:
from DockerBuildSystem import DockerComposeTools, DockerImageTools, DockerSwarmTools, TerminalTools, VersionTools
- Merge, build and run docker-compose.*.yml files:
composeFiles = [
'docker-compose.yml',
'docker-compose.build.yml',
'docker-compose.override.yml'
]
mergedComposeFile = "docker-compose.generated.dev.yml"
DockerComposeTools.MergeComposeFiles(composeFiles, mergedComposeFile)
DockerComposeTools.DockerComposeBuild([mergedComposeFile])
DockerComposeTools.DockerComposeUp([mergedComposeFile])
- Push and pull images in docker-compose.*.yml files, including additional
latesttag:
composeFiles = [
'docker-compose.yml'
]
DockerComposeTools.DockerComposePush(composeFiles)
DockerComposeTools.PublishDockerImagesWithNewTag(composeFiles, 'latest')
DockerComposeTools.DockerComposePull(composeFiles)
- Execute test projects in Docker containers and raise exception if container exits with error code due to failing tests:
composeFiles = [
'docker-compose.tests.yml'
]
testContainerNames = [
'lab-services-tests'
]
DockerComposeTools.ExecuteComposeTests(composeFiles, testContainerNames)
- Load set of specific environment variables from a
*.envfile:
TerminalTools.LoadEnvironmentVariables('path_to/variables.env')
- Export top-most version from CHANGELOG.md file (see the example folder) as an environment variable:
VersionTools.ExportVersionFromChangelogToEnvironment("path_to/CHANGELOG.md", "version")
- Optionally export versionmajor and versionminor based on the top-most version from CHANGELOG.md file as an environment variable:
VersionTools.ExportVersionFromChangelogToEnvironment("path_to/CHANGELOG.md", "version", "versionmajor", "versionminor")
- to use the DockerComposeTools.PromoteDockerImages functionality, provide the following parameters:
- composeFile - the compose file containing theimages that should be promoted
- targetTags - the tags you want to use when you push the image to the new feed
- sourceFeed - the feed you want to pull the images from (should match the compose file)
- targetFeed - the feed you want to push to
- user - used for authenticating to sourceFeed and targetFeed
- password - used for authenticating to sourceFeed and targetFeed
- dryRun - boolean. True if you want to do a dryRun, i.e. print what would have happened
Please have a look at an example of use here:
Prerequisites
- Docker:
- Install Dependencies:
- pip install -r requirements.txt
Additional Info
- The pip package may be located at:
Publish New Version.
- Configure setup.py with new version.
- Install build tools:
pip install twine wheel - Build: python setup.py bdist_wheel
- Check: twine check dist/*
- Publish: twine upload dist/*
Test a new version locally
- Build: python setup.py bdist_wheel
- Install from local file with force-reinstall and no-cache-dir options to force reinstallation when you have changed the code without changing the version number:
python -m pip install path\to\yourgitrepo\DockerBuildSystem\dist\DockerBuildSystem-1.1.43-py2.py3-none-any.whl --force-reinstall --no-cache-dir
Run Unit Tests
- python -m unittest discover -p Test.py
Metadata
Release files for dockerbuildsystem 1.1.65
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dockerbuildsystem-1.1.65-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for dockerbuildsystem-1.1.65-py2.py3-none-any.whl |
Release files / dockerbuildsystem-1.1.65-py2.py3-none-any.whl
| Download URL | dockerbuildsystem-1.1.65-py2.py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
95200fa0d6a2b63b8578f54e53741d454413d99955d124b8488fdf9166a91205
|
|
BLAKE2b-256 checksum How to use checksums |
a51232ea168e9e18edc3f4aef7220034f99e01def2f8693d88ba554cb733b74a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.17
|
Security for dockerbuildsystem 1.1.65
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.