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.2.0.tar.gz
(25.1 kB
view details)
Built Distribution
File details
Details for the file dockerfile-parse-1.2.0.tar.gz
.
File metadata
- Download URL: dockerfile-parse-1.2.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07e65eec313978e877da819855870b3ae47f3fac94a40a965b9ede10484dacc5 |
|
MD5 | 42efe5c354c830045b756e76eb4f84d5 |
|
BLAKE2b-256 | d0f68eb044e3837f6da0a85d9f73158104fecdab68bc86a83625b1e398963ed3 |
File details
Details for the file dockerfile_parse-1.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: dockerfile_parse-1.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3fc8f491e1af8cb5f9e23ea6437a2913467b88a4be143095f150330b090be7e |
|
MD5 | b72d75c6c8b4a42f5f85d44fd91a8abd |
|
BLAKE2b-256 | 5383e9579a25c26bc8e1a6033e46e756e18c25caa05bfc421673d99d1af2efab |