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-0.0.17.tar.gz
(21.2 kB
view hashes)
Built Distributions
Close
Hashes for dockerfile_parse-0.0.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868a6a00db2150ae92af177757eb35210f54243f6d8b2c362fe777e44fc98279 |
|
MD5 | 914b68871e42b337c915f1239f195a6d |
|
BLAKE2b-256 | a43eda91452dc2c45787d4b1e8566dc6095c117bcde1ad0292c978956a796a04 |
Close
Hashes for dockerfile_parse-0.0.17-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b8ab184c24ab35c2a0af47b1766dfeeeb7f47da42197ee9756aa4695c60c775 |
|
MD5 | 042084759cfdb877e1c4e61384a566e4 |
|
BLAKE2b-256 | d30d650e77c15ba4975e203d6f26a6ce16cb72d935541f09a0188fa6e62ce621 |