47 lines
1.1 KiB
Bash
47 lines
1.1 KiB
Bash
#! /bin/bash
|
|
|
|
REGISTRY_USER="registry"
|
|
REGISTRY_NAME="registry.cloud.etaviaporte.com"
|
|
REGISTRY_SERVER="registry.cloud.etaviaporte.com"
|
|
CONTAINER_VERSION="latest"
|
|
|
|
# Requirements
|
|
# Docker: Node v18-alpine
|
|
function build_docker(){
|
|
#Global ENV VAR: REGISTRY_NAME
|
|
#Global ENV VAR: CONTAINER_NAME
|
|
if [[ $# -lt 1 ]]; then
|
|
echo $0 "[conatiner name]"
|
|
return -1
|
|
fi
|
|
CONTAINER_NAME=$1
|
|
cat src/config/apiConfig.json > src/config/apiConfig_local.json
|
|
|
|
set -x
|
|
docker rmi -f "$REGISTRY_NAME/$CONTAINER_NAME"
|
|
docker buildx build --no-cache -t $REGISTRY_NAME/$CONTAINER_NAME ./
|
|
set +x
|
|
}
|
|
|
|
function upload_image(){
|
|
#Global ENV VAR: REGISTRY_NAME
|
|
#Global ENV VAR: CICD_REGISTRY_TOKEN
|
|
#Global ENV VAR: CONTAINER_NAME
|
|
docker login $REGISTRY_SERVER -u "$REGISTRY_USER" -p "$CICD_REGISTRY_TOKEN"
|
|
set -x
|
|
docker push "$REGISTRY_NAME/$CONTAINER_NAME":$CONTAINER_VERSION
|
|
set +x
|
|
}
|
|
|
|
function deploy_prod(){
|
|
set -x
|
|
echo "Not yet defined"
|
|
set +x
|
|
}
|
|
|
|
function deploy_dev(){
|
|
set -x
|
|
echo "Not yet defined"
|
|
set +x
|
|
}
|