diff --git a/docker-bake.hcl b/docker-bake.hcl index 9203ffecd2..1efac9464c 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -159,3 +159,9 @@ target "e2e-image" { VERSION = VERSION } } + +target "e2e-gencerts" { + inherits = ["_common"] + dockerfile = "./e2e/testdata/Dockerfile.gencerts" + output = ["./e2e/testdata"] +} diff --git a/e2e/testdata/Dockerfile.gencerts b/e2e/testdata/Dockerfile.gencerts new file mode 100644 index 0000000000..e19b4358c3 --- /dev/null +++ b/e2e/testdata/Dockerfile.gencerts @@ -0,0 +1,19 @@ +# syntax=docker/dockerfile:1 + +ARG GO_VERSION=1.19.7 + +FROM golang:${GO_VERSION}-alpine AS generated +RUN go install github.com/dmcgowan/quicktls@master +WORKDIR /tmp/gencerts/notary +RUN --mount=type=bind,source=e2e/testdata/notary,target=/tmp/gencerts/notary,rw <> notary-server.cert + mv ca.pem root-ca.cert + cp notary-server.cert notary-server.key root-ca.cert ../notary-evil + cp -r /tmp/gencerts/notary* /out/ +EOT + +FROM scratch +COPY --from=generated /out / diff --git a/e2e/testdata/gen-certs.sh b/e2e/testdata/gen-certs.sh deleted file mode 100755 index 51e74e9918..0000000000 --- a/e2e/testdata/gen-certs.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env sh -set -eu - -# This script is used to generate the test-certificates in the notary-server and -# evil-notary-server directories. Run this script to update the certificates if -# they expire. -GO111MODULE=off go get -u github.com/dmcgowan/quicktls -cd notary -quicktls -org=Docker -with-san notary-server notaryserver evil-notary-server evilnotaryserver localhost 127.0.0.1 -cat ca.pem >> notary-server.cert -mv ca.pem root-ca.cert -cp notary-server.cert notary-server.key root-ca.cert ../notary-evil/