From 5ecf2c9769dc81b1a9da2c4ef1821184766a370b Mon Sep 17 00:00:00 2001 From: gongzt Date: Mon, 24 Apr 2023 09:36:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E9=94=AE=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E4=B8=AD=E6=A3=80=E6=9F=A5docker=E3=80=81docker-compo?= =?UTF-8?q?se=E5=AE=89=E8=A3=85=E7=9A=84=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=A4=E4=BA=92=E5=BC=8F=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E4=B8=AD=E6=A0=87=E8=AF=86=E7=AC=A6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deploy/container/aops-apollo/Dockerfile | 2 +- .../deploy/container/aops-diana/Dockerfile | 2 +- scripts/deploy/container/run.sh | 22 ++++++++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/scripts/deploy/container/aops-apollo/Dockerfile b/scripts/deploy/container/aops-apollo/Dockerfile index 996b7ec..ea0a3fc 100644 --- a/scripts/deploy/container/aops-apollo/Dockerfile +++ b/scripts/deploy/container/aops-apollo/Dockerfile @@ -1,5 +1,5 @@ FROM openeuler/openeuler:22.03-lts-sp1 WORKDIR /app -COPY *.repo /app/ +COPY * /app/ RUN dnf install aops-apollo -y --setopt=reposdir=/app CMD ["/bin/bash","/app/start.sh"] \ No newline at end of file diff --git a/scripts/deploy/container/aops-diana/Dockerfile b/scripts/deploy/container/aops-diana/Dockerfile index 03297ec..9e9eef9 100644 --- a/scripts/deploy/container/aops-diana/Dockerfile +++ b/scripts/deploy/container/aops-diana/Dockerfile @@ -1,5 +1,5 @@ FROM openeuler/openeuler:22.03-lts-sp1 WORKDIR /app -COPY *.repo /app/ +COPY * /app/ RUN dnf install aops-diana -y --setopt=reposdir=/app CMD ["/bin/bash","/app/start.sh"] \ No newline at end of file diff --git a/scripts/deploy/container/run.sh b/scripts/deploy/container/run.sh index c32a57a..581c0bc 100755 --- a/scripts/deploy/container/run.sh +++ b/scripts/deploy/container/run.sh @@ -44,10 +44,6 @@ prometheus(){ docker_build(){ copy_aops_conf prepare_dockerfile_repo - storage_mysql_data - storage_es_data - prometheus - docker-compose -f docker-compose-base-service.yml build --no-cache docker-compose build --no-cache rm ./aops-apollo/*.repo rm ./aops-diana/*.repo @@ -56,14 +52,21 @@ docker_build(){ } install_docker_compose(){ - installed_docker_compose=`rpm -ql docker-compose` - if [ "$(echo $installed_docker_compose | grep "is not installed")" != "" ]; then + docker_compose_installed=`rpm -q docker-compose` + if [ $? -ne 0 ] ; then dnf install docker-compose -y + else + echo "docker-compose is already installed." + fi + docker_installed=`rpm -q docker` + if [ $? -ne 0 ] ; then + dnf install docker -y + else + echo "docker is already installed." fi } main(){ - install_docker_compose while : do @@ -71,7 +74,7 @@ main(){ echo "1. Build the docker container (build)." echo "2. Start the container orchestration service (start-service/start-env)." echo "3. Stop all container services (stop-service/stop-env)." - read "Enter to exit the operation (Q/q)." + echo "Enter to exit the operation (Q/q)." read -p "Select an operation procedure to continue: " operation case $operation in "build") @@ -82,6 +85,9 @@ main(){ docker-compose up -d ;; "start-env") + prometheus + storage_es_data + storage_mysql_data docker-compose -f docker-compose-base-service.yml up -d ;; "stop-service") -- Gitee