2017-08-25 07:20:03 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
CERT_IMAGE="alpine:edge"
|
|
|
|
|
|
|
|
# cd to the current directory so the script can be run from anywhere.
|
2019-05-06 07:40:04 +00:00
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${0}" )" && pwd -P)"; export SCRIPT_DIR
|
|
|
|
cd "${SCRIPT_DIR}"
|
2017-08-25 07:20:03 +00:00
|
|
|
|
|
|
|
# Update the cert image.
|
|
|
|
docker pull $CERT_IMAGE
|
|
|
|
|
|
|
|
# Fetch the latest certificates.
|
|
|
|
ID=$(docker run -d $CERT_IMAGE sh -c "apk --update upgrade && apk add ca-certificates && update-ca-certificates")
|
2019-05-10 15:24:06 +00:00
|
|
|
docker logs -f "${ID}"
|
|
|
|
docker wait "${ID}"
|
2017-08-25 07:20:03 +00:00
|
|
|
|
|
|
|
# Update the local certificates.
|
2019-05-10 15:24:06 +00:00
|
|
|
docker cp "${ID}":/etc/ssl/certs/ca-certificates.crt "${SCRIPT_DIR}"
|
2017-08-25 07:20:03 +00:00
|
|
|
|
|
|
|
# Cleanup.
|
2019-05-10 15:24:06 +00:00
|
|
|
docker rm -f "${ID}"
|