Skip to content

Commit 7b583d8

Browse files
committed
Adds better support for acme.sh install out of the box
1 parent 428eed8 commit 7b583d8

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

docker/Dockerfile.acmesh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,19 @@ ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
99
COPY ./files/.bashrc.acmesh /root/.bashrc
1010

1111
# acme.sh
12-
RUN mkdir -p /data/acme.sh \
13-
&& curl -o /bin/acme.sh 'https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh' \
14-
&& chmod +x /bin/acme.sh
12+
RUN curl -o /tmp/acme.sh 'https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh' \
13+
&& chmod +x /tmp/acme.sh
14+
15+
ENV ACMESH_CONFIG_HOME=/data/.acme.sh/config \
16+
ACMESH_HOME=/data/.acme.sh \
17+
CERT_HOME=/data/.acme.sh/certs \
18+
LE_CONFIG_HOME=/data/.acme.sh/config \
19+
LE_WORKING_DIR=/data/.acme.sh
20+
21+
# this wrapper handles all the setup required for acme.sh and running commands for it
22+
COPY ./files/acme.sh-wrapper /bin/acme.sh
23+
24+
# Test that the wrapper script is working
25+
RUN /bin/acme.sh -h
1526

1627
LABEL org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:acmesh"

files/acme.sh-wrapper

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash -e
2+
3+
# Ensure acme.sh dirs exist
4+
mkdir -p "$ACMESH_HOME" "$ACMESH_CONFIG_HOME" "$CERT_HOME" "$LE_CONFIG_HOME" "$LE_WORKING_DIR"
5+
6+
ACMESH_SCRIPT=/data/.acme.sh/acme.sh
7+
8+
# Check for existence of $ACME_SH_SCRIPT
9+
if ! [ -f "$ACMESH_SCRIPT" ]; then
10+
echo "$ACMESH_SCRIPT does not exist, installing acme.sh ..."
11+
cd /tmp
12+
./acme.sh --install --force --home "$ACMESH_HOME" --cert-home "$CERT_HOME" --config-home "$ACMESH_CONFIG_HOME"
13+
fi
14+
15+
$ACMESH_SCRIPT --config-home "$ACMESH_CONFIG_HOME" "$@"

0 commit comments

Comments
 (0)