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