Add ca-certificates to Dockerfile
feature/request
### Is there an existing issue or pull request for this?
- [x] I have searched the existing issues and pull requests
### Feature description
The `docker.io/orhunp/git-cliff` image is built using the `bookworm-slim` base image. That image doesn't include `ca-certificates` which is required to add custom trusted certificates to remotes.
The [git-cliff documentation](https://git-cliff.org/docs/configuration/remote#native_tls:~:text=However%2C%20in%20some%20cases%2C%20you%20may%20want%20to%20use%20the%20platform%27s%20native%20certificate%20store%2C%20especially%20if%20you%27re%20relying%20on%20a%20corporate%20trust%20root%20(e.g.%2C%20for%20a%20mandatory%20proxy)%20that%27s%20included%20in%20your%20system%27s%20certificate%20store.) mentions support for corporate trust roots when using the `--use-native-tls` CLI option but that isn't currently supported in the provided Docker image.
### Desired solution
I'd love for `ca-certificates` to be installed in the project's provided Docker image by adding the following to the `Dockerfile`:
```
RUN apt-get update && apt-get install -y \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
```
### Alternatives considered
While users can always build on top of the Docker image to add both the binary and their trusted CAs, that's not ideal. For example, when using with GitLab CI/CD, if the Docker image already includes `ca-certificates` the following adds the server's TLS trust chain to the pipeline job:
```
changelog:
image:
name: orhunp/git-cliff:latest
entrypoint: [""]
variables:
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
stage: doc
before_script:
- mkdir -p usr/local/share/ca-certificates/
- cp "$CI_SERVER_TLS_CA_FILE" /usr/local/share/ca-certificates/gitlab-ca.crt
- update-ca-certificates
script:
- git-cliff -r . > CHANGELOG.md
artifacts:
paths:
- CHANGELOG.md
```
That's preferred to always installing `ca-certificates` in every job before setting up the truststore.
Another alternative would be to include a `--cacert` option ([similar to `curl`](https://curl.se/docs/manpage.html#:~:text=ca%2Dnative.-,%2D%2Dcacert,-%3Cfile%3E)) that allows users to directly specify the CA trust chain at runtime. However, I assume this solution would be harder to implement.
### Additional context
My goal is to use `git-cliff` to build release notes for project's on my private GitLab server that has it's own self-signed root CA.
5 条评论