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-2.0.0.tar.gz
(24.6 kB
view details)
Built Distribution
File details
Details for the file dockerfile-parse-2.0.0.tar.gz
.
File metadata
- Download URL: dockerfile-parse-2.0.0.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21fe7d510642f2b61a999d45c3d9745f950e11fe6ba2497555b8f63782b78e45 |
|
MD5 | 5651ddb096292ee1218db402570acb11 |
|
BLAKE2b-256 | 0fc48c4fc1da93a67878b15eaac0d47f467c87be7a12406544b1b33e261a0454 |
File details
Details for the file dockerfile_parse-2.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: dockerfile_parse-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8d9100f8255914378bc0524ffaad68ef043885b0fb40a6936b1bba458f40c3f |
|
MD5 | 17fa7217e000047e7efb19f5dea113e3 |
|
BLAKE2b-256 | aea7f0c54dd8e82660240f0fe202231160594d63006b22b78e7799ffc0f611c9 |