Skip to main content

A Docker build system for managing docker.

Project description

Docker Build System

PyPI version Build Status MIT license

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 latest tag:
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 *.env file:
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")

Please have a look at an example of use here:

Prerequisites

Additional Info

Publish New Version.

  1. Configure setup.py with new version.
  2. Build: python setup.py bdist_wheel
  3. Publish: twine upload dist/*

Run Unit Tests

  • python -m unittest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

DockerBuildSystem-1.1.40-py2.py3-none-any.whl (9.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page