Ensure env vars are set for acme.sh images

This commit is contained in:
Jamie Curnow
2022-01-18 17:26:01 +10:00
parent 44e2654f0e
commit 7a629736fb
2 changed files with 30 additions and 1 deletions
+8 -1
View File
@@ -13,7 +13,14 @@ RUN apt-get update \
# copy go from golang
COPY --from=go /usr/local/go /usr/local/go
ENV GOPATH=/opt/go PATH="/usr/local/go/bin:$PATH:/opt/go/bin"
ENV GOPATH=/opt/go \
PATH="/usr/local/go/bin:$PATH:/opt/go/bin" \
ACMESH_CONFIG_HOME=/data/.acme.sh/config \
ACMESH_HOME=/data/.acme.sh \
CERT_HOME=/data/.acme.sh/certs \
LE_CONFIG_HOME=/data/.acme.sh/config \
LE_WORKING_DIR=/data/.acme.sh
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \
&& chmod -R 777 "$GOPATH" \
&& echo "====> ${TARGETPLATFORM}: $(go version)"
+22
View File
@@ -1,5 +1,27 @@
#!/bin/bash -e
# Ensure env vars are set
if [ "$ACMESH_HOME" = "" ]; then
echo "Error: ACMESH_HOME is not set!"
exit 1
fi
if [ "$ACMESH_CONFIG_HOME" = "" ]; then
echo "Error: ACMESH_CONFIG_HOME is not set!"
exit 1
fi
if [ "$CERT_HOME" = "" ]; then
echo "Error: CERT_HOME is not set!"
exit 1
fi
if [ "$LE_CONFIG_HOME" = "" ]; then
echo "Error: LE_CONFIG_HOME is not set!"
exit 1
fi
if [ "$LE_WORKING_DIR" = "" ]; then
echo "Error: LE_WORKING_DIR is not set!"
exit 1
fi
# Ensure acme.sh dirs exist
mkdir -p "$ACMESH_HOME" "$ACMESH_CONFIG_HOME" "$CERT_HOME" "$LE_CONFIG_HOME" "$LE_WORKING_DIR"