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
- Parses Dockerfiles for git checkouts
- Fetches the latest commit hash for each repository
- Updates the Dockerfile with the new commit hashes
- Writes the updated Dockerfile to the specified destination
- 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:
- Update the version number in
setup.py
. - Create a new tag with the version number:
git tag v<version_number> git push origin v<version_number>
- Build the distribution packages:
python setup.py sdist
- 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
File details
Details for the file dockerfile-git-hash-0.1.1.tar.gz
.
File metadata
- Download URL: dockerfile-git-hash-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce5187c1a9296347b414890efb711399a65519ea5f9e5e2666f50dff1546e61b |
|
MD5 | 5c8a699863dd118f6329e86e9b5244f1 |
|
BLAKE2b-256 | 3789d5925eed74b0cb7d1e399f1fa89687c145bc14e2fadf94996ebe4d074468 |