package parsing docker files
Project description
Docker parser
Docker attempts to simplify machine processing of dockerfiles. This moduel is not intended to extend docker SDK or build images, instead it attempts to parse instructions into simply manipulatable python objects, deduce state of environment in which commands are executed and allow modification of resulting dockerfile.
Instalation
pip3 install docker-parser
Usage
Print all executed RUN commands
from docker_parser import parser
with open("dockerfile") as src:
dockerfile = parser.Parser.loads(src.read())
for cmd in dockerfile.run():
print(cmd.arg)
dockerfile:
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y gcc make
COPY ./src /var/tmp/
WORKDIR /var/tmp/src
RUN make
output:
apt update
apt install -y gcc make
make
for more examples refer to examples
Contributing
To contribute:
- Increment version in pyproject.toml
- Create merge request to
preprod
branch - Once your changes are reviewed and merged, pipeline publishes new version to testpypi
- After verifying that changes don't break rest of the code and don't justify major release, changes will be pushed to
main
branch and pushed to production pypi
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
docker_parser-0.0.8.tar.gz
(10.5 MB
view hashes)
Built Distribution
Close
Hashes for docker_parser-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a53330e1dedf38a2fd7bdde50a905b03b121bc6f6c7fefb77d38c1e273c58f38 |
|
MD5 | 3358b21a817f9e33fe8cfbc173d2653d |
|
BLAKE2b-256 | 7b9182feb2f4f7536ae9f604daeb25f802440315d14ede9209b018ccad642081 |