Skip to main content

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:

  1. Increment version in pyproject.toml
  2. Create merge request to preprod branch
  3. Once your changes are reviewed and merged, pipeline publishes new version to testpypi
  4. 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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docker_parser-0.0.8-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file docker_parser-0.0.8.tar.gz.

File metadata

  • Download URL: docker_parser-0.0.8.tar.gz
  • Upload date:
  • Size: 10.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for docker_parser-0.0.8.tar.gz
Algorithm Hash digest
SHA256 b0d255b006dd7993cf76944b73bd9042bf6d5e9b9bd56ac94a6630ea715a4542
MD5 711dc6c4c34276183a83994e16d59bde
BLAKE2b-256 79eb19bf3f21d186a2f46e483fb647b6d7c02e3d8008898e037494061aa71425

See more details on using hashes here.

File details

Details for the file docker_parser-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: docker_parser-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for docker_parser-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a53330e1dedf38a2fd7bdde50a905b03b121bc6f6c7fefb77d38c1e273c58f38
MD5 3358b21a817f9e33fe8cfbc173d2653d
BLAKE2b-256 7b9182feb2f4f7536ae9f604daeb25f802440315d14ede9209b018ccad642081

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page