Add support for environment variables which control wether to use staging or not and which type of challenge is used
This commit is contained in:
parent
adadb253ab
commit
6b5c016334
13
Dockerfile
13
Dockerfile
|
@ -2,7 +2,12 @@ FROM jcgruenhage/baseimage-alpine
|
||||||
MAINTAINER Jan Christian Grünhage <jan.christian@gruenhage.xyz>
|
MAINTAINER Jan Christian Grünhage <jan.christian@gruenhage.xyz>
|
||||||
|
|
||||||
ENV UID=192 \
|
ENV UID=192 \
|
||||||
GID=192
|
GID=192 \
|
||||||
|
STAGING=1 \
|
||||||
|
CHALLENGE="dns-01"
|
||||||
|
|
||||||
|
# Set STAGING to false(0) by default, set to true(1) to use staging LE-Endpoint
|
||||||
|
# Set CHALLENGE to "dns-01" (DNS Challenge) by default, set to "http-01" to use the HTTP Challenge
|
||||||
|
|
||||||
RUN apk update \
|
RUN apk update \
|
||||||
&& apk add --upgrade \
|
&& apk add --upgrade \
|
||||||
|
@ -14,12 +19,14 @@ RUN apk update \
|
||||||
bash \
|
bash \
|
||||||
su-exec \
|
su-exec \
|
||||||
libxml2-utils \
|
libxml2-utils \
|
||||||
&& git clone https://github.com/lukas2511/dehydrated /dehydrated
|
&& git clone https://github.com/lukas2511/dehydrated /dehydrated
|
||||||
|
|
||||||
|
# Add the files in the 'root' folder to the images filesystem
|
||||||
ADD root /
|
ADD root /
|
||||||
|
|
||||||
|
|
||||||
VOLUME /etc/dehydrated
|
VOLUME /etc/dehydrated
|
||||||
VOLUME /var/www/dehydrated
|
VOLUME /var/www/dehydrated
|
||||||
VOLUME /certs
|
VOLUME /certs
|
||||||
|
|
||||||
|
# Execute the setup script
|
||||||
|
RUN bash /etc/once/setup.sh
|
||||||
|
|
23
root/etc/once/setup.sh
Normal file
23
root/etc/once/setup.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copy the example config file to the config location
|
||||||
|
cp /dehydrated/docs/examples/config /etc/dehydrated/config
|
||||||
|
|
||||||
|
# Use the staging endpoint?
|
||||||
|
if [ $STAGING -ne 0 ]; then
|
||||||
|
sed -ie 's/#CA=.*$/CA="https:\/\/acme-staging.api.letsencrypt.org\/directory"/g' /etc/dehydrated/config
|
||||||
|
sed -ie 's/#CA_TERMS=.*$/CA_TERMS="https:\/\/acme-staging.api.letsencrypt.org\/terms"/g' /etc/dehydrated/config
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the challenge-type
|
||||||
|
case "$CHALLENGE" in
|
||||||
|
"http-01")
|
||||||
|
sed -ie 's/#CHALLENGETYPE=.*$/CHALLENGETYPE="http-01"/g' /etc/dehydrated/config
|
||||||
|
;;
|
||||||
|
"dns-01")
|
||||||
|
sed -ie 's/#CHALLENGETYPE=.*$/CHALLENGETYPE="dns-01"/g' /etc/dehydrated/config
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "WARNING: Unknown Challenge type! Using default from dehydrated"
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in a new issue