2016-11-25 12:49:16 +00:00
|
|
|
#!/bin/bash
|
2019-04-27 12:51:12 +00:00
|
|
|
#
|
|
|
|
# This script is responsible for calling `docker build` on behalf of GitHub. But
|
|
|
|
# what it _really_ does is translate `DOCKER_TAG` into the builds args `TARGET`
|
|
|
|
# and `OPENSSL_VERSION`.
|
2016-11-25 12:45:10 +00:00
|
|
|
|
|
|
|
# Abort if anything goes wrong.
|
|
|
|
set -euo pipefail
|
|
|
|
|
2020-04-10 13:23:08 +00:00
|
|
|
# Default to using OpenSSL 1.1 now, because 1.0 has stopped receiving security
|
|
|
|
# updates. 1.1 is incompatible with the crates postgres 0.15 and openssl 0.9,
|
|
|
|
# so we do offer the option of falling back to 1.0.
|
|
|
|
OPENSSL_VERSION=1.1.1f
|
2019-04-27 12:51:12 +00:00
|
|
|
|
|
|
|
# Pick an appropriate Docker tag
|
2019-04-18 13:44:12 +00:00
|
|
|
case "$DOCKER_TAG" in
|
2019-04-27 12:51:12 +00:00
|
|
|
*-openssl11)
|
|
|
|
DOCKER_TAG_WITHOUT_OPENSSL="${DOCKER_TAG/-openssl11/}"
|
2020-04-10 13:23:08 +00:00
|
|
|
;;
|
|
|
|
*-openssl10)
|
|
|
|
DOCKER_TAG_WITHOUT_OPENSSL="${DOCKER_TAG/-openssl10/}"
|
|
|
|
OPENSSL_VERSION=1.0.2u
|
2019-04-27 12:51:12 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
DOCKER_TAG_WITHOUT_OPENSSL="$DOCKER_TAG"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Decide what Rust toolchain to use.
|
|
|
|
case "$DOCKER_TAG_WITHOUT_OPENSSL" in
|
2019-04-18 13:44:12 +00:00
|
|
|
# Always map the Docker tags `latest` and `experimental` to stable Rust.
|
2019-04-27 12:51:12 +00:00
|
|
|
latest)
|
2019-04-18 13:44:12 +00:00
|
|
|
TOOLCHAIN=stable
|
|
|
|
;;
|
|
|
|
# Strip `experimental-` from other `experimental-*` tags.
|
|
|
|
experimental-*)
|
2019-04-27 12:51:12 +00:00
|
|
|
TOOLCHAIN="${DOCKER_TAG_WITHOUT_OPENSSL/experimental-/}"
|
2019-04-18 13:44:12 +00:00
|
|
|
;;
|
2019-04-27 12:51:12 +00:00
|
|
|
# Pass all other tags through.
|
2019-04-18 13:44:12 +00:00
|
|
|
*)
|
2019-04-27 12:51:12 +00:00
|
|
|
TOOLCHAIN="$DOCKER_TAG_WITHOUT_OPENSSL"
|
2019-04-18 13:44:12 +00:00
|
|
|
;;
|
|
|
|
esac
|
2016-11-25 12:45:10 +00:00
|
|
|
|
|
|
|
# Run the build.
|
2019-04-27 12:51:12 +00:00
|
|
|
docker build \
|
|
|
|
--build-arg TOOLCHAIN="$TOOLCHAIN" \
|
|
|
|
--build-arg OPENSSL_VERSION="$OPENSSL_VERSION" \
|
|
|
|
-t "$IMAGE_NAME" \
|
|
|
|
.
|