Skip to content

lachmanfrantisek/dockerfile-parse

 
 

Repository files navigation

dockerfile-parse

Build Status Coverage Status

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/DBuildService/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)

About

Python library for parsing Dockerfile files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.2%
  • Shell 2.8%