Skip to main content

A simple automatic Dockerfile documentation generator

Project description

Docks: Easy Dockerfile Documentation Generator 📜🐳

Python

publish workflow License: MIT

docks is a Python framework designed to generate Markdown documentation for your Dockerfiles. It extracts key elements such as base images, ARG/ENV variables, exposed ports, and copied/added files, producing clear, structured documentation.

Features ✨

  • Extracts:
    • Base Images (FROM)
    • ARG/ENV Variables with optional docstrings and references
    • Exposed Ports with descriptions
    • Copied/Added Files (COPY/ADD) with context
  • Outputs clean Markdown documentation for your Dockerfiles.
  • Easy to use, modular, and extensible.

Installation 🚀

Install docks via Poetry or pip:

Using Poetry

poetry add docks

Using Pip

pip install docks

Usage 🛠️

Example: Generate Documentation from a Dockerfile

  1. Ensure you have a valid Dockerfile in your project.
  2. Run the following Python script
from docks.generate_doc import generate_markdown

# Path to your Dockerfile
dockerfile_path = "Dockerfile"

# Output Markdown file
output_path = "README.md"

# Generate documentation
generate_markdown(dockerfile_path, output_path)

Dockerfile Docstring Convention 📝

ARG/ENV Variables

  • Include a block comment directly above the variable.
  • Start the comment with the variable name followed by : for docstring extraction.
  • Optionally include a reference using @ref:.

Example

# MY_VAR: Description of the variable.
# @ref: https://example.com/docs
ARG MY_VAR=default

EXPOSE Ports

Include a comment directly above the EXPOSE command. Start with the port number followed by : for the description.

Example

# 8080: Main HTTP server port
EXPOSE 8080

COPY/ADD Files

Add a comment directly above the COPY or ADD command for context.

Example

# Copy application code to the container
COPY src/ /app/

Testing ✅

Run tests with pytest:

pytest tests/

Contributing 🤝

We welcome contributions! Please follow these steps:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/<FEATURE_NAME>.
  3. Commit your changes: git commit -m "Add feature".
  4. Push the branch: git push origin feature/<FEATURE_NAME>.
  5. Open a pull request.

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

docks-0.1.8.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

docks-0.1.8-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file docks-0.1.8.tar.gz.

File metadata

  • Download URL: docks-0.1.8.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for docks-0.1.8.tar.gz
Algorithm Hash digest
SHA256 3986d244cf96a16cf9c062089bd870e8589e6f57790414b264ccfee83b384f08
MD5 5cbba2382e4ff9bd5c86eb89044b2461
BLAKE2b-256 abf10b8b998cd83ffba4f8e5d588577cf70d1a557b2cca18b5ec1c39780272f3

See more details on using hashes here.

File details

Details for the file docks-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: docks-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for docks-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 961d895d02ee9b907b55023c3932de114053db858b3e44927da3cbec408b495d
MD5 7f43ca53ccb40b1373b74af50dec8725
BLAKE2b-256 f70efcc7aa2b4dada40ca4de5d88504948c6bed5a0fb14ae47240b3158ef5c20

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