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 dockerfile-parse using 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.16.tar.gz
(21.4 kB
view details)
File details
Details for the file dockerfile-parse-0.0.16.tar.gz
.
File metadata
- Download URL: dockerfile-parse-0.0.16.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e3c6f190eff204ab232ebba34d2f5c68591d22a27a9606bf2612c17499ec30b |
|
MD5 | ce9832bd6c8f5b5621aa2d27d9f5b1c7 |
|
BLAKE2b-256 | 60a9e040a5001546d4f100659f8dda99d77bf660d22a6ace0022b8a20c74c5cc |