17 lines
777 B
Bash
17 lines
777 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
|
API_FLAVOR=${API_FLAVOR:-corex}
|
|
VERSION=${VERSION:-2.7.1}
|
|
[[ "$VERSION" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$ ]] || exit 2
|
|
case "$API_FLAVOR" in
|
|
corex) FILE=docker/china/Dockerfile.corex ;;
|
|
cuda) FILE=docker/global/Dockerfile.cuda ;;
|
|
*) echo "API_FLAVOR must be corex or cuda" >&2; exit 2 ;;
|
|
esac
|
|
exec docker build -f "$ROOT_DIR/$FILE" \
|
|
--label io.unis.component=parser --label io.unis.layout=refact --label "io.unis.gpu=$API_FLAVOR" \
|
|
--label "org.opencontainers.image.revision=$(git -C "$ROOT_DIR" rev-parse HEAD)" \
|
|
-t "unis-mineru:$VERSION-$API_FLAVOR" -t "unis-mineru:$VERSION" \
|
|
-t "unis-mindmap-api:$VERSION" -t "unis-mindmap-api:$API_FLAVOR" -t unis-mindmap-api:latest "$ROOT_DIR"
|