#!/bin/bash . $(pwd)/sh/config.sh ENV=$(cat "$(pwd)/env") # 使用if-elif-else结构判断环境 if [ "$ENV"=="produce" ]; then ADDRESS="${PRODUCE_ADDRESS}" elif [ "$ENV"=="test" ]; then ADDRESS="${TEST_ADDRESS}" else ADDRESS="${PRODUCE_ADDRESS}" fi docker pull ${ADDRESS}:${VERSION} docker rm -f "${CONTAINER}" docker run -it -p "${PORT}:${PORT}" --name "${CONTAINER}" "${IMAGE}:${VERSION}"