Python library for Dockerfile manipulation
Project description
dockerfile-parse
Python library for parsing Dockerfile files.
Installation
From PyPI
pip install dockerfile-parse
From git
Clone this git repo and install using the python installer
git clone https://github.com/containerbuildsystem/dockerfile-parse.git
cd dockerfile-parse
sudo pip install .
Usage
from pprint import pprint
from dockerfile_parse import DockerfileParser
dfp = DockerfileParser()
dfp.content = """\
From base
LABEL foo="bar baz"
USER me"""
# Print the parsed structure:
pprint(dfp.structure)
pprint(dfp.json)
pprint(dfp.labels)
# Set a new base:
dfp.baseimage = 'centos:7'
# Print the new Dockerfile with an updated FROM line:
print(dfp.content)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dockerfile-parse-1.0.0.tar.gz
(23.7 kB
view details)
Built Distribution
File details
Details for the file dockerfile-parse-1.0.0.tar.gz
.
File metadata
- Download URL: dockerfile-parse-1.0.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ed92ede29a646094b52b8b302e477f08e63465b6ee524f5750810280143712e |
|
MD5 | 4e0bf6e29c1e64d9576812ab992df8f8 |
|
BLAKE2b-256 | db08911fa4adaa312f65de783dc8636ca1f513a8de5477cd9551ffcc466d08f7 |
File details
Details for the file dockerfile_parse-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: dockerfile_parse-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f04920c573d980904ce99abc70e31d28140d9195fb10f4d50c2dee1b6f45ebed |
|
MD5 | 8be58885e0042529edc88d4371de7417 |
|
BLAKE2b-256 | 6f5c20478e075634215d7dde9a489b905441f80b0eddc4d49d5d54091cb781a3 |