export GO111MODULE=on export GOPROXY=https://goproxy.cn,direct export GOPATH=/root/go export GOCACHE=/root/.cache/go-build export CONTAINER_NAME=ai_scheduler export CGO_ENABLED='0' MODE="$1" if [ "$MODE" != "dev" ] && [ "$MODE" != "prod" ]; then echo "Usage: $0 dev|prod" exit 1 fi CONFIG_FILE="config/config.yaml" BRANCH="master" if [ "$MODE" = "dev" ]; then CONFIG_FILE="config/config_test.yaml" BRANCH="test" fi git fetch origin git checkout "$BRANCH" git pull origin "$BRANCH" go mod tidy make build docker build -t ${CONTAINER_NAME} . docker stop ${CONTAINER_NAME} docker rm -f ${CONTAINER_NAME} docker run -itd \ --name "${CONTAINER_NAME}" \ --restart=always \ -e "OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}" \ -e "MODE=${MODE}" \ -p 8090:8090 \ "${CONTAINER_NAME}" ./bin/server --config "./${CONFIG_FILE}" docker logs -f ${CONTAINER_NAME}