examples: create certs bake definition

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax committed 2023-07-17 12:29:59 +02:00
1 parent ee8af2d80f
commit 64346c9a3a
3 files changed
+39

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
# syntax=docker/dockerfile:1
FROM alpine:edge AS gen
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk --update --no-cache add mkcert@testing ca-certificates
WORKDIR /certs
RUN mkdir -p daemon client
ARG SAN=localhost
ARG SAN_CLIENT=client
RUN echo $SAN | tr " " "\n" >SAN
RUN CAROOT=$(pwd) mkcert -cert-file daemon/cert.pem -key-file daemon/key.pem $SAN
RUN CAROOT=$(pwd) mkcert -client -cert-file client/cert.pem -key-file client/key.pem $SAN_CLIENT
RUN cp -f rootCA.pem daemon/ca.pem
RUN cp -f rootCA.pem client/ca.pem
RUN rm -f rootCA.pem rootCA-key.pem
FROM scratch
COPY --from=gen /certs /
+7
View File
@@ -0,0 +1,7 @@
# Create BuildKit certificates
This [bake definition](docker-bake.hcl) can be used for creating certificates:
```bash
SAN="127.0.0.1" docker buildx bake https://github.com/moby/buildkit.git#master:examples/create-certs
```
+14
View File
@@ -0,0 +1,14 @@
variable "SAN" {
default = "127.0.0.1"
}
group "default" {
targets = ["certs"]
}
target "certs" {
args = {
SAN = SAN
}
output = ["./.certs"]
}