Files
kenaito-lab/image/runtime-tomcat9/build.sh
T

22 lines
858 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 先下载 Tomcat 9.0.124 到当前目录并校验官方 sha512,再基于本地文件构建镜像
# 官方包直接 ADD 解压,不解包重打:镜像内部与 Tomcat 发行版完全一致,便于对照文档排障
set -euo pipefail
cd "$(dirname "$0")"
VERSION=9.0.124
PKG=apache-tomcat-${VERSION}.tar.gz
URL=https://archive.apache.org/dist/tomcat/tomcat-9/v${VERSION}/bin/${PKG}
if [ ! -f "${PKG}" ]; then
curl -fL -o "${PKG}" "${URL}"
curl -fL -o "${PKG}.sha512" "${URL}.sha512"
# 校验官方 sha512,下载损坏或中间人改写时直接失败(sha512 文件格式:<hash> *<文件名>)
echo "$(awk '{print $1}' "${PKG}.sha512") ${PKG}" | shasum -a 512 -c -
rm -f "${PKG}.sha512"
fi
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-tomcat9
docker build -t "${IMAGE}" .
docker push "${IMAGE}"