fix: fix create-server-certificate with Dockerfile

This commit is contained in:
matteocng 2017-08-28 13:08:39 +02:00
parent f05f7a0ff9
commit fd41843972
No known key found for this signature in database
GPG key ID: 0A84A748DF3E8C38
2 changed files with 15 additions and 1 deletions

8
test/certs/Dockerfile Normal file
View file

@ -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/*

View file

@ -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