From fd41843972e766921613586f5a8b696c299cf9f2 Mon Sep 17 00:00:00 2001 From: matteocng Date: Mon, 28 Aug 2017 13:08:39 +0200 Subject: [PATCH] fix: fix create-server-certificate with Dockerfile --- test/certs/Dockerfile | 8 ++++++++ test/certs/create_server_certificate.sh | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/certs/Dockerfile diff --git a/test/certs/Dockerfile b/test/certs/Dockerfile new file mode 100644 index 0000000..c3b5428 --- /dev/null +++ b/test/certs/Dockerfile @@ -0,0 +1,8 @@ +FROM nginx:1.13 +LABEL maintainer="Jason Wilder mail@jasonwilder.com" + +# Install `openssl` and clean up the `apt` cache. +RUN apt update \ + && apt install openssl -y --no-install-recommends \ + && apt-get clean \ + && rm -r /var/lib/apt/lists/* diff --git a/test/certs/create_server_certificate.sh b/test/certs/create_server_certificate.sh index bffc27e..f174e68 100755 --- a/test/certs/create_server_certificate.sh +++ b/test/certs/create_server_certificate.sh @@ -19,12 +19,18 @@ else ALTERNATE_DOMAINS="DNS:$( echo "$@" | sed 's/ /,DNS:/g')" fi +############################################################################### +# Create a `nginx-openssl` image (`nginx` image with `openssl` installed) +############################################################################### + +NGINX_OPENSSL_IMAGE="nginx-proxy/nginx-openssl" +docker build . -t "$NGINX_OPENSSL_IMAGE" ############################################################################### # Create a nginx container (which conveniently provides the `openssl` command) ############################################################################### -CONTAINER=$(docker run -d -v $DIR:/work -w /work -e SAN="$ALTERNATE_DOMAINS" nginx:1.13) +CONTAINER=$(docker run -d -v $DIR:/work -w /work -e SAN="$ALTERNATE_DOMAINS" "$NGINX_OPENSSL_IMAGE") # Configure openssl docker exec $CONTAINER bash -c ' mkdir -p /ca/{certs,crl,private,newcerts} 2>/dev/null