Skip to main content

A tool to update commit hashes in Dockerfiles

Project description

dockerfile-git-hash

dockerfile-git-hash is a command-line tool to update the commit hashes in a Dockerfile. It parses the Dockerfile for git checkouts, fetches the latest commit hashes for the repositories, and updates the Dockerfile accordingly.

Installation

You can install dockerfile-git-hash using pip:

pip install dockerfile-git-hash

Usage

dockerfile-git-hash <dockerfile_path> <destination_path>
  • <dockerfile_path>: Path to the Dockerfile or directory containing the Dockerfile
  • <destination_path>: Destination path for the updated Dockerfile

If a directory is provided instead of a Dockerfile, dockerfile-git-hash will look for a file named "Dockerfile" in that directory.

Features

  1. Parses Dockerfiles for git checkouts
  2. Fetches the latest commit hash for each repository
  3. Updates the Dockerfile with the new commit hashes
  4. Writes the updated Dockerfile to the specified destination
  5. Copies additional files (run.sh, run.bat, build.sh, build.bat, docker-compose.yaml) if present

Example

dockerfile-git-hash ./my_project/Dockerfile ./updated_dockerfile/Dockerfile

This command will update the Dockerfile in the my_project directory and save the updated version in the updated_dockerfile directory.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Releasing on PyPI

To release a new version of dockerfile-git-hash on PyPI, follow these steps:

  1. Update the version number in setup.py.
  2. Create a new tag with the version number:
    git tag v<version_number>
    git push origin v<version_number>
    
  3. Build the distribution packages:
    python setup.py sdist
    
  4. Upload the packages to PyPI:
    twine upload dist/*
    

Make sure you have twine installed (pip install twine) and that you have the necessary credentials to upload to 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

dockerfile_git_hash-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file dockerfile_git_hash-0.1.0.tar.gz.

File metadata

  • Download URL: dockerfile_git_hash-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.6

File hashes

Hashes for dockerfile_git_hash-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae6cc59d2fa9eb3e0d0ad190907cb44cd71066ddd9ddfce3d2c89e696be07f03
MD5 c41a14ff4c3c1957d19af2440d233951
BLAKE2b-256 7e4ff7c8a98d6c25c2e258db1426b42af9fae9ce14b13195a29e079e4259df0d

See more details on using hashes here.

Supported by

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