Skip to content

Commit 7a62973

Browse files
committed
Ensure env vars are set for acme.sh images
1 parent 44e2654 commit 7a62973

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

docker/Dockerfile.acmesh-golang

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ RUN apt-get update \
1313
# copy go from golang
1414
COPY --from=go /usr/local/go /usr/local/go
1515

16-
ENV GOPATH=/opt/go PATH="/usr/local/go/bin:$PATH:/opt/go/bin"
16+
ENV GOPATH=/opt/go \
17+
PATH="/usr/local/go/bin:$PATH:/opt/go/bin" \
18+
ACMESH_CONFIG_HOME=/data/.acme.sh/config \
19+
ACMESH_HOME=/data/.acme.sh \
20+
CERT_HOME=/data/.acme.sh/certs \
21+
LE_CONFIG_HOME=/data/.acme.sh/config \
22+
LE_WORKING_DIR=/data/.acme.sh
23+
1724
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \
1825
&& chmod -R 777 "$GOPATH" \
1926
&& echo "====> ${TARGETPLATFORM}: $(go version)"

files/acme.sh-wrapper

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
#!/bin/bash -e
22

3+
# Ensure env vars are set
4+
if [ "$ACMESH_HOME" = "" ]; then
5+
echo "Error: ACMESH_HOME is not set!"
6+
exit 1
7+
fi
8+
if [ "$ACMESH_CONFIG_HOME" = "" ]; then
9+
echo "Error: ACMESH_CONFIG_HOME is not set!"
10+
exit 1
11+
fi
12+
if [ "$CERT_HOME" = "" ]; then
13+
echo "Error: CERT_HOME is not set!"
14+
exit 1
15+
fi
16+
if [ "$LE_CONFIG_HOME" = "" ]; then
17+
echo "Error: LE_CONFIG_HOME is not set!"
18+
exit 1
19+
fi
20+
if [ "$LE_WORKING_DIR" = "" ]; then
21+
echo "Error: LE_WORKING_DIR is not set!"
22+
exit 1
23+
fi
24+
325
# Ensure acme.sh dirs exist
426
mkdir -p "$ACMESH_HOME" "$ACMESH_CONFIG_HOME" "$CERT_HOME" "$LE_CONFIG_HOME" "$LE_WORKING_DIR"
527

0 commit comments

Comments
 (0)