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.1.0.tar.gz
(24.6 kB
view details)
Built Distribution
File details
Details for the file dockerfile-parse-1.1.0.tar.gz
.
File metadata
- Download URL: dockerfile-parse-1.1.0.tar.gz
- Upload date:
- Size: 24.6 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.47.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f37bfa327fada7fad6833aebfaac4a3aaf705e4cf813b737175feded306109e8 |
|
MD5 | 6c0071ec34a9a80e0a0adf01e852f3ce |
|
BLAKE2b-256 | 70f32da4b506a16aab83096b61c9095e4ebf0a77bd4a2d2a2f8367b323e8141f |
File details
Details for the file dockerfile_parse-1.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: dockerfile_parse-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.8 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.47.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80ea4b88694ab014001e39e62335aa2f4feb695b80de751377e994a344fa5952 |
|
MD5 | 3c63b6f5b60ab01be684ea91c2848582 |
|
BLAKE2b-256 | a32bce24c022aa6528b637c6bec85416bc5d2a76e2b68524d4ed5ed80ae01d88 |