DockerBuildSystem


NameDockerBuildSystem JSON
Version 1.1.61 PyPI version JSON
download
home_pagehttps://github.com/hansehe/DockerBuildSystem
SummaryA Docker build system for managing docker.
upload_time2024-08-02 16:17:20
maintainerNone
docs_urlNone
authorHans Erik Heggem
requires_pythonNone
licenseNone
keywords docker build system
VCS
bugtrack_url
requirements python-dotenv pyyaml semantic-version
Travis-CI
coveralls test coverage No coveralls.
            # Docker Build System

[![PyPI version](https://badge.fury.io/py/DockerBuildSystem.svg)](https://badge.fury.io/py/DockerBuildSystem)
[![Build Status](https://travis-ci.com/hansehe/DockerBuildSystem.svg?branch=master)](https://travis-ci.com/hansehe/DockerBuildSystem)
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)

A simple library for handling docker commands with python.

## Install Or Upgrade
- pip install --upgrade DockerBuildSystem

## Example
- Include DockerBuildSystem tools:
```python
from DockerBuildSystem import DockerComposeTools, DockerImageTools, DockerSwarmTools, TerminalTools, VersionTools
```

- Merge, build and run docker-compose.*.yml files:
```python
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:
```python
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:
```python
composeFiles = [
    'docker-compose.tests.yml'
]
testContainerNames = [
    'lab-services-tests'
]
DockerComposeTools.ExecuteComposeTests(composeFiles, testContainerNames)
```

- Load set of specific environment variables from a `*.env` file:
```python
TerminalTools.LoadEnvironmentVariables('path_to/variables.env')
```

- Export top-most version from CHANGELOG.md file (see the example folder) as an environment variable:
```python
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:
```python
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:
- https://github.com/hansehe/DockerBuildSystem/tree/master/example

## Prerequisites
- Docker:
    - https://www.docker.com/get-docker
- Install Dependencies:
    - pip install -r requirements.txt

## Additional Info
- The pip package may be located at:
    - https://pypi.org/project/DockerBuildSystem

## 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 discover -p *Test*.py


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansehe/DockerBuildSystem",
    "name": "DockerBuildSystem",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Docker Build System",
    "author": "Hans Erik Heggem",
    "author_email": "hans.erik.heggem@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "# Docker Build System\n\n[![PyPI version](https://badge.fury.io/py/DockerBuildSystem.svg)](https://badge.fury.io/py/DockerBuildSystem)\n[![Build Status](https://travis-ci.com/hansehe/DockerBuildSystem.svg?branch=master)](https://travis-ci.com/hansehe/DockerBuildSystem)\n[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)\n\nA simple library for handling docker commands with python.\n\n## Install Or Upgrade\n- pip install --upgrade DockerBuildSystem\n\n## Example\n- Include DockerBuildSystem tools:\n```python\nfrom DockerBuildSystem import DockerComposeTools, DockerImageTools, DockerSwarmTools, TerminalTools, VersionTools\n```\n\n- Merge, build and run docker-compose.*.yml files:\n```python\ncomposeFiles = [\n    'docker-compose.yml',\n    'docker-compose.build.yml',\n    'docker-compose.override.yml'\n]\nmergedComposeFile = \"docker-compose.generated.dev.yml\"\nDockerComposeTools.MergeComposeFiles(composeFiles, mergedComposeFile)\nDockerComposeTools.DockerComposeBuild([mergedComposeFile])\nDockerComposeTools.DockerComposeUp([mergedComposeFile])\n```\n\n- Push and pull images in docker-compose.*.yml files, including additional `latest` tag:\n```python\ncomposeFiles = [\n    'docker-compose.yml'\n]\nDockerComposeTools.DockerComposePush(composeFiles)\nDockerComposeTools.PublishDockerImagesWithNewTag(composeFiles, 'latest')\nDockerComposeTools.DockerComposePull(composeFiles)\n```\n\n- Execute test projects in Docker containers and raise exception if container exits with error code due to failing tests:\n```python\ncomposeFiles = [\n    'docker-compose.tests.yml'\n]\ntestContainerNames = [\n    'lab-services-tests'\n]\nDockerComposeTools.ExecuteComposeTests(composeFiles, testContainerNames)\n```\n\n- Load set of specific environment variables from a `*.env` file:\n```python\nTerminalTools.LoadEnvironmentVariables('path_to/variables.env')\n```\n\n- Export top-most version from CHANGELOG.md file (see the example folder) as an environment variable:\n```python\nVersionTools.ExportVersionFromChangelogToEnvironment(\"path_to/CHANGELOG.md\", \"version\")\n```\n- Optionally export versionmajor and versionminor based on the top-most version from CHANGELOG.md file as an environment variable:\n```python\nVersionTools.ExportVersionFromChangelogToEnvironment(\"path_to/CHANGELOG.md\", \"version\", \"versionmajor\", \"versionminor\")\n```\n\n- to use the DockerComposeTools.PromoteDockerImages functionality, provide the following parameters:\n- composeFile - the compose file containing theimages that should be promoted\n- targetTags - the tags you want to use when you push the image to the new feed\n- sourceFeed - the feed you want to pull the images from (should match the compose file)\n- targetFeed - the feed you want to push to\n- user - used for authenticating to sourceFeed and targetFeed\n- password - used for authenticating to sourceFeed and targetFeed\n- dryRun - boolean. True if you want to do a dryRun, i.e. print what would have happened\n\nPlease have a look at an example of use here:\n- https://github.com/hansehe/DockerBuildSystem/tree/master/example\n\n## Prerequisites\n- Docker:\n    - https://www.docker.com/get-docker\n- Install Dependencies:\n    - pip install -r requirements.txt\n\n## Additional Info\n- The pip package may be located at:\n    - https://pypi.org/project/DockerBuildSystem\n\n## Publish New Version.\n1. Configure setup.py with new version.\n2. Install build tools: `pip install twine wheel`\n3. Build: python setup.py bdist_wheel\n4. Check: twine check dist/*\n5. Publish: twine upload dist/*\n\n## Test a new version locally\n1. Build: python setup.py bdist_wheel\n2. 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`\n\n## Run Unit Tests\n- python -m unittest discover -p *Test*.py\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Docker build system for managing docker.",
    "version": "1.1.61",
    "project_urls": {
        "Funding": "https://donate.pypi.org",
        "Homepage": "https://github.com/hansehe/DockerBuildSystem",
        "Say Thanks!": "http://saythanks.io/to/example",
        "Source": "https://github.com/hansehe/DockerBuildSystem"
    },
    "split_keywords": [
        "docker",
        "build",
        "system"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2743146c414fe07f10d8d60fdafd81620af627fffccc55508a0f8a854a1d9ecd",
                "md5": "b02c7594a3eef6a44c471861024c6572",
                "sha256": "bf6b0724255bbe6973961896b82a138b228d5c18c423bf5f1196c5acdb584986"
            },
            "downloads": -1,
            "filename": "DockerBuildSystem-1.1.61-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b02c7594a3eef6a44c471861024c6572",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 11759,
            "upload_time": "2024-08-02T16:17:20",
            "upload_time_iso_8601": "2024-08-02T16:17:20.424071Z",
            "url": "https://files.pythonhosted.org/packages/27/43/146c414fe07f10d8d60fdafd81620af627fffccc55508a0f8a854a1d9ecd/DockerBuildSystem-1.1.61-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-02 16:17:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansehe",
    "github_project": "DockerBuildSystem",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "python-dotenv",
            "specs": []
        },
        {
            "name": "pyyaml",
            "specs": []
        },
        {
            "name": "semantic-version",
            "specs": []
        }
    ],
    "lcname": "dockerbuildsystem"
}
        
Elapsed time: 0.34287s