transfer_middleware/sh/depoly.sh

17 lines
404 B
Bash
Executable File

#!/bin/bash
. $(pwd)/sh/config.sh
ENV=$(cat "$(pwd)/sh/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}"