| 1 |
# syntax=docker/dockerfile:1 |
| 2 |
|
| 3 |
FROM alpine:edge AS gen |
| 4 |
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories |
| 5 |
RUN apk --update --no-cache add mkcert@testing ca-certificates |
| 6 |
WORKDIR /certs |
| 7 |
RUN mkdir -p daemon client |
| 8 |
ARG SAN=localhost |
| 9 |
ARG SAN_CLIENT=client |
| 10 |
RUN echo $SAN | tr " " "\n" >SAN |
| 11 |
RUN CAROOT=$(pwd) mkcert -cert-file daemon/cert.pem -key-file daemon/key.pem $SAN |
| 12 |
RUN CAROOT=$(pwd) mkcert -client -cert-file client/cert.pem -key-file client/key.pem $SAN_CLIENT |
| 13 |
RUN cp -f rootCA.pem daemon/ca.pem |
| 14 |
RUN cp -f rootCA.pem client/ca.pem |
| 15 |
RUN rm -f rootCA.pem rootCA-key.pem |
| 16 |
|
| 17 |
FROM scratch |
| 18 |
COPY --from=gen /certs / |