Skip to content

Commit 16e0442

Browse files
committed
feat: use bash expansion instead of test conditions for variables
1 parent bf27984 commit 16e0442

File tree

21 files changed

+118
-105
lines changed

21 files changed

+118
-105
lines changed

README.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,23 @@ For the available versions please look at [Docker Hub][dockerhub] or
2323

2424
```console
2525
CADDY_ADAPTER = caddyfile
26-
CADDY_AGREE = false
27-
CADDY_CA =
28-
CADDY_CA_TIMEOUT =
2926
CADDY_CONFIG = /etc/caddy/caddyfile
30-
CADDY_CPU =
31-
CADDY_DEFAULT_SNI =
32-
CADDY_DISABLE_ALPN_CHALLENGE =
33-
CADDY_DISABLE_HTTP_CHALLENGE =
34-
CADDY_DISABLE_METRICS =
3527
CADDY_DROP_INDEX_FILE = false
36-
CADDY_EMAIL =
37-
CADDY_ENV =
3828
CADDY_ENVFILE =
3929
CADDY_ENVIRON = false
40-
CADDY_GRACE =
4130
CADDY_HEALTHCHECK_CODE = 200
4231
CADDY_HEALTHCHECK_URL = http://localhost:8080/
43-
CADDY_HOST =
44-
CADDY_HTTP_PORT =
45-
CADDY_HTTP2 =
46-
CADDY_HTTPS_PORT =
47-
CADDY_LOG =
48-
CADDY_LOG_ROLL_COMPRESS =
49-
CADDY_LOG_ROLL_MB =
5032
CADDY_PIDFILE =
5133
CADDY_PINGBACK =
52-
CADDY_PORT =
53-
CADDY_QUIC =
54-
CADDY_QUIET =
5534
CADDY_RESUME = false
5635
CADDY_SKIP_CHOWN = false
5736
CADDY_SKIP_TEMPLATES = false
5837
CADDY_WATCH = false
5938
CADDY_WEBROOT = /srv/www
6039
```
6140

41+
Extracted by the command: `grep -hE ': "\$\{(.*)\}"' latest/overlay/etc/entrypoint.d/*.sh | sed 's/: "\${//' | sed 's/:="/ = /' | sed 's/"}"$//' | sort | uniq`
42+
6243
## Inherited environment variables
6344

6445
* [webhippie/alpine](https://github.com/dockhippie/alpine#available-environment-variables)

latest/Dockerfile.amd64

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ RUN apk update && \
3535

3636
COPY --from=build /srv/app/caddy /usr/sbin/caddy
3737
COPY ./overlay /
38+
39+
RUN find /etc/container.d /etc/entrypoint.d -type f -name \*.sh -exec sed -i 's/\r$//' {} +; \
40+
sed -i 's/\r$//' /usr/bin/healthcheck /usr/bin/container && \
41+
chmod +x /usr/bin/healthcheck /usr/bin/container /etc/container.d/*.sh /etc/entrypoint.d/*.sh

latest/Dockerfile.arm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ RUN apk update && \
3535

3636
COPY --from=build /srv/app/caddy /usr/sbin/caddy
3737
COPY ./overlay /
38+
39+
RUN find /etc/container.d /etc/entrypoint.d -type f -name \*.sh -exec sed -i 's/\r$//' {} +; \
40+
sed -i 's/\r$//' /usr/bin/healthcheck /usr/bin/container && \
41+
chmod +x /usr/bin/healthcheck /usr/bin/container /etc/container.d/*.sh /etc/entrypoint.d/*.sh

latest/Dockerfile.arm64

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ RUN apk update && \
3535

3636
COPY --from=build /srv/app/caddy /usr/sbin/caddy
3737
COPY ./overlay /
38+
39+
RUN find /etc/container.d /etc/entrypoint.d -type f -name \*.sh -exec sed -i 's/\r$//' {} +; \
40+
sed -i 's/\r$//' /usr/bin/healthcheck /usr/bin/container && \
41+
chmod +x /usr/bin/healthcheck /usr/bin/container /etc/container.d/*.sh /etc/entrypoint.d/*.sh
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/usr/bin/env bash
22

33
declare -x PUID
4-
[[ -z "${PUID}" ]] && PUID="1000"
4+
: "${PUID:="1000"}"
55

66
declare -x PGID
7-
[[ -z "${PGID}" ]] && PGID="1000"
8-
9-
true
7+
: "${PGID:="1000"}"
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,46 @@
11
#!/usr/bin/env bash
22

33
declare -x CADDY_ADAPTER
4-
[[ -z "${CADDY_ADAPTER}" ]] && CADDY_ADAPTER="caddyfile"
4+
: "${CADDY_ADAPTER:="caddyfile"}"
55

66
declare -x CADDY_CONFIG
7-
[[ -z "${CADDY_CONFIG}" ]] && CADDY_CONFIG="/etc/caddy/caddyfile"
7+
: "${CADDY_CONFIG:="/etc/caddy/caddyfile"}"
88

99
declare -x CADDY_ENVFILE
10-
[[ -z "${CADDY_ENVFILE}" ]] && CADDY_ENVFILE=""
10+
: "${CADDY_ENVFILE:=""}"
1111

1212
declare -x CADDY_ENVIRON
13-
[[ -z "${CADDY_ENVIRON}" ]] && CADDY_ENVIRON="false"
13+
: "${CADDY_ENVIRON:="false"}"
1414

1515
declare -x CADDY_PIDFILE
16-
[[ -z "${CADDY_PIDFILE}" ]] && CADDY_PIDFILE=""
16+
: "${CADDY_PIDFILE:=""}"
1717

1818
declare -x CADDY_PINGBACK
19-
[[ -z "${CADDY_PINGBACK}" ]] && CADDY_PINGBACK=""
19+
: "${CADDY_PINGBACK:=""}"
2020

2121
declare -x CADDY_PINGBACK
22-
[[ -z "${CADDY_PINGBACK}" ]] && CADDY_PINGBACK=""
22+
: "${CADDY_PINGBACK:=""}"
2323

2424
declare -x CADDY_RESUME
25-
[[ -z "${CADDY_RESUME}" ]] && CADDY_RESUME="false"
25+
: "${CADDY_RESUME:="false"}"
2626

2727
declare -x CADDY_WATCH
28-
[[ -z "${CADDY_WATCH}" ]] && CADDY_WATCH="false"
28+
: "${CADDY_WATCH:="false"}"
2929

3030
declare -x CADDY_WEBROOT
31-
[[ -z "${CADDY_WEBROOT}" ]] && CADDY_WEBROOT="/srv/www"
31+
: "${CADDY_WEBROOT:="/srv/www"}"
3232

3333
declare -x CADDY_SKIP_TEMPLATES
34-
[[ -z "${CADDY_SKIP_TEMPLATES}" ]] && CADDY_SKIP_TEMPLATES="false"
34+
: "${CADDY_SKIP_TEMPLATES:="false"}"
3535

3636
declare -x CADDY_SKIP_CHOWN
37-
[[ -z "${CADDY_SKIP_CHOWN}" ]] && CADDY_SKIP_CHOWN="false"
37+
: "${CADDY_SKIP_CHOWN:="false"}"
3838

3939
declare -x CADDY_HEALTHCHECK_URL
40-
[[ -z "${CADDY_HEALTHCHECK_URL}" ]] && CADDY_HEALTHCHECK_URL="http://localhost:8080/"
40+
: "${CADDY_HEALTHCHECK_URL:="http://localhost:8080/"}"
4141

4242
declare -x CADDY_HEALTHCHECK_CODE
43-
[[ -z "${CADDY_HEALTHCHECK_CODE}" ]] && CADDY_HEALTHCHECK_CODE="200"
43+
: "${CADDY_HEALTHCHECK_CODE:="200"}"
4444

4545
declare -x CADDY_DROP_INDEX_FILE
46-
[[ -z "${CADDY_DROP_INDEX_FILE}" ]] && CADDY_DROP_INDEX_FILE="false"
47-
48-
true
46+
: "${CADDY_DROP_INDEX_FILE:="false"}"

v2.10/Dockerfile.amd64

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ RUN apk update && \
3838

3939
COPY --from=build /srv/app/caddy /usr/sbin/caddy
4040
COPY ./overlay /
41+
42+
RUN find /etc/container.d /etc/entrypoint.d -type f -name \*.sh -exec sed -i 's/\r$//' {} +; \
43+
sed -i 's/\r$//' /usr/bin/healthcheck /usr/bin/container && \
44+
chmod +x /usr/bin/healthcheck /usr/bin/container /etc/container.d/*.sh /etc/entrypoint.d/*.sh

v2.10/Dockerfile.arm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ RUN apk update && \
3838

3939
COPY --from=build /srv/app/caddy /usr/sbin/caddy
4040
COPY ./overlay /
41+
42+
RUN find /etc/container.d /etc/entrypoint.d -type f -name \*.sh -exec sed -i 's/\r$//' {} +; \
43+
sed -i 's/\r$//' /usr/bin/healthcheck /usr/bin/container && \
44+
chmod +x /usr/bin/healthcheck /usr/bin/container /etc/container.d/*.sh /etc/entrypoint.d/*.sh

v2.10/Dockerfile.arm64

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ RUN apk update && \
3838

3939
COPY --from=build /srv/app/caddy /usr/sbin/caddy
4040
COPY ./overlay /
41+
42+
RUN find /etc/container.d /etc/entrypoint.d -type f -name \*.sh -exec sed -i 's/\r$//' {} +; \
43+
sed -i 's/\r$//' /usr/bin/healthcheck /usr/bin/container && \
44+
chmod +x /usr/bin/healthcheck /usr/bin/container /etc/container.d/*.sh /etc/entrypoint.d/*.sh
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/usr/bin/env bash
22

33
declare -x PUID
4-
[[ -z "${PUID}" ]] && PUID="1000"
4+
: "${PUID:="1000"}"
55

66
declare -x PGID
7-
[[ -z "${PGID}" ]] && PGID="1000"
8-
9-
true
7+
: "${PGID:="1000"}"

0 commit comments

Comments
 (0)