Dockerfiles for many of the images hosted at my username on Docker Hub.
There are several utilities that I would like to use but for which either Docker images aren't published, or I don't want to have to trust their images.
Instead of finding some random image that someone else wrote for the utility, most are simple enough to replicate minimally and self-publish.
All Docker images are built with GitHub Actions and pushed to Docker Hub on merge to main.
To do something locally, you can use make:
$ make build-curl # builds the docker image for `curl` subdirectory
$ make test-curl # builds the docker image for `curl` subdirectory and runs tests
$ make dive-curl # builds the docker image for `curl` subdirectory and opens the resulting image in `dive` (to inspect filesystem)
$ make publish-curl # builds the docker image for `curl` subdirectory and publishes to Docker HubTo create a new image, all you need to do is:
- Create the subdirectory for your project (it will map to
parkr/$diras the image name), withDockerfile,VERSION, andtest.shfiles. - Fill out the
VERSIONfile for your desired version. It can be a Git SHA-1, a semver version, etc. - Write the
Dockerfileto accept a build argumentVERSIONand use that to fetch the program at the given version. When you want the default branch of a project, be sure to uselatestinVERSION, and map that to the default branch in yourDockerfile. - Write
test.shto exit 1 if the Docker image isn't working. This might be a DockerHEALTHCHECKthat you verify is healthy upon starting the image, or maybe it's as simple as making sure the utility file is installed and executable. - Add the entries to
.github/actionsfiles. Copying a pre-existing utility's actions/steps in the file will help. Let's keep these files alphabetical. - Push to a feature branch.
- Verify tests pass, then merge.
We use cosign to sign images. Here's our public key:
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAELbA3dMq2RK0jZMhtMEpH74UEAfUw
6RXclfsLvG8Rsjs3p8eTmgaVedTc84I6c0oART8uozH1RcUwFNgRg/aNTQ==
-----END PUBLIC KEY-----
To verify, write that to cosign.pub and:
$ docker pull <IMAGE>
Pulling ...
$ cosign verify -key cosign.pub <IMAGE>
Verification for <IMAGE> --
The following checks were performed on each of these signatures:
- The cosign claims were validated
- The signatures were verified against the specified public key
- Any certificates were verified against the Fulcio roots.This repository uses the MIT License.