添加部署命令
This commit is contained in:
parent
9153e1de6e
commit
93d95254b7
|
@ -12,7 +12,7 @@ import (
|
|||
"trasfer_middleware/until/sysLog"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "../../../config/transfer_local.yaml", "the config file")
|
||||
var configFile = flag.String("f", "../../../config/transfer_produce.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
|
|
@ -16,9 +16,10 @@ import (
|
|||
"trasfer_middleware/cmd/rpc/internal/server"
|
||||
"trasfer_middleware/cmd/rpc/internal/svc"
|
||||
"trasfer_middleware/cmd/rpc/pb/transfer"
|
||||
"trasfer_middleware/until"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "../../config/transfer_local.yaml", "the config file")
|
||||
var configFile = flag.String("f", until.GetConfig(), "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
source ./config.sh
|
||||
|
||||
docker build -t "${IMAGE}:${VERSION}" . --no-cache
|
||||
|
||||
docker tag "${IMAGE}:${TAGS_NAME}" ${ADDRESS}:${TAGS_NAME}
|
||||
docker tag "${IMAGE}:${VERSION}" ${ADDRESS}:${VERSION}
|
||||
|
||||
docker push ${ADDRESS}:${TAGS_NAME}
|
||||
docker push ${ADDRESS}:${VERSION}
|
|
@ -1,14 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
IMAGE="transfer_middleware"
|
||||
RPC_CONTAINER="transfer_middleware"
|
||||
RPC_PORT="10001"
|
||||
V_REFLECT=""
|
||||
TAGS_NAME="v1"
|
||||
ADDRESS="registry.cn-chengdu.aliyuncs.com/go_ls/transfer_middleware"
|
||||
. $(pwd)/sh/config.sh
|
||||
Environment="produce"
|
||||
ADDRESS="${PRODUCE_ADDRESS}"
|
||||
echo "produce"> $(pwd)/sh/env
|
||||
|
||||
docker build -t "${IMAGE}:${TAGS_NAME}" . --no-cache
|
||||
. $(pwd)/sh/build.sh
|
||||
|
||||
docker tag "${IMAGE}:${TAGS_NAME}" ${ADDRESS}:${TAGS_NAME}
|
||||
|
||||
docker push ${ADDRESS}:${TAGS_NAME}
|
|
@ -1,14 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
IMAGE="transfer_middleware"
|
||||
RPC_CONTAINER="transfer_middleware"
|
||||
RPC_PORT="10001"
|
||||
V_REFLECT=""
|
||||
TAGS_NAME="v1"
|
||||
ADDRESS="registry.cn-chengdu.aliyuncs.com/go_ls/transfer_middleware"
|
||||
|
||||
docker build -t "${IMAGE}:${TAGS_NAME}" . --no-cache
|
||||
|
||||
docker tag "${IMAGE}:${TAGS_NAME}" ${ADDRESS}:${TAGS_NAME}
|
||||
|
||||
docker push ${ADDRESS}:${TAGS_NAME}
|
||||
. $(pwd)/sh/config.sh
|
||||
Environment="test"
|
||||
ADDRESS="${TEST_ADDRESS}"
|
||||
echo "test"> $(pwd)/sh/env
|
||||
sh $(pwd)/sh/build.sh
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
IMAGE="transfer_middleware"
|
||||
CONTAINER="transfer_middleware"
|
||||
PORT="10001"
|
||||
TEST_ADDRESS="registry.cn-chengdu.aliyuncs.com/go_ls/transfer_middleware"
|
||||
PRODUCE_ADDRESS="registry.cn-chengdu.aliyuncs.com/go_ls/transfer_middleware_produce"
|
||||
COMMIT_CONTENT="UPDATE"
|
||||
VERSION="v1"
|
23
sh/depoly.sh
23
sh/depoly.sh
|
@ -1,14 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
IMAGE="transfer_middleware:v1"
|
||||
RPC_CONTAINER="transfer_middleware"
|
||||
RPC_PORT="10001"
|
||||
V_REFLECT=""
|
||||
. $(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 build -t "${IMAGE}" . --no-cache
|
||||
docker stop "${RPC_CONTAINER}"
|
||||
|
||||
docker rm "${RPC_CONTAINER}"
|
||||
|
||||
#docker run -it -p "${RPC_PORT}:${RPC_PORT}" --name "$RPC_CONTAINER" "${IMAGE}"
|
||||
docker pull ${ADDRESS}:${VERSION}
|
||||
docker rm -f "${CONTAINER}"
|
||||
docker run -it -p "${PORT}:${PORT}" --name "${CONTAINER}" "${IMAGE}:${VERSION}"
|
|
@ -1 +1,8 @@
|
|||
package until
|
||||
|
||||
import "os"
|
||||
|
||||
func GetConfig() string {
|
||||
|
||||
return os.Getenv("GO_ENV")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue