Giter Club home page Giter Club logo

dockerbuildsystem's Introduction

Docker Build System

PyPI version Build Status MIT license

!DEPRECATED!

Please follow new source:

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")
  • 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

Additional Info

Publish New Version.

  1. Configure setup.py with new version.
  2. Install build tools: pip install twine wheel
  3. Build: python setup.py bdist_wheel
  4. Check: twine check dist/*
  5. Publish: twine upload dist/*

Test a new version locally

  1. Build: python setup.py bdist_wheel
  2. 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

dockerbuildsystem's People

Contributors

aho-dips avatar hansehe avatar idasc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hansehe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.