fix: fix create-server-certificate with Dockerfile
This commit is contained in:
parent
f05f7a0ff9
commit
fd41843972
2 changed files with 15 additions and 1 deletions
8
test/certs/Dockerfile
Normal file
8
test/certs/Dockerfile
Normal 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/*
|
||||||
|
|
@ -19,12 +19,18 @@ else
|
||||||
ALTERNATE_DOMAINS="DNS:$( echo "$@" | sed 's/ /,DNS:/g')"
|
ALTERNATE_DOMAINS="DNS:$( echo "$@" | sed 's/ /,DNS:/g')"
|
||||||
fi
|
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)
|
# 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
|
# Configure openssl
|
||||||
docker exec $CONTAINER bash -c '
|
docker exec $CONTAINER bash -c '
|
||||||
mkdir -p /ca/{certs,crl,private,newcerts} 2>/dev/null
|
mkdir -p /ca/{certs,crl,private,newcerts} 2>/dev/null
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue