feat: optimize dockerfile option

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong(cubxxw-openim)
2023-08-21 12:11:09 +08:00
parent cf8bba036f
commit 3599d4b7ef
8 changed files with 65 additions and 132 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ scripts/
│ └── pre-push # Script to run before each push
├── init_pwd.sh # Script to initialize password
├── install_im_compose.sh # Script to install IM with Docker Compose
├── install_im_server.sh # Script to install IM server
├── install-im-server.sh # Script to install IM server
├── lib # Library scripts
│ ├── color.sh # Script for console color manipulation
│ ├── golang.sh # Script for golang related utility functions
+1 -6
View File
@@ -14,13 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Include shell font styles and some basic information
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "$SCRIPTS_ROOT/style_info.sh"
echo -e "${GREEN_PREFIX}=========> Check docker-compose status ${COLOR_SUFFIX} \n"
source "${OPENIM_ROOT}/scripts/install/common.sh"
cd "$OPENIM_ROOT"
+2 -2
View File
@@ -22,10 +22,10 @@ source "${OPENIM_ROOT}/scripts/install/common.sh"
trap 'openim::util::onCtrlC' INT
nohup ${OPENIM_ROOT}/scripts/start-all.sh > ${LOG_FILE} 2>&1 &
nohup ${OPENIM_ROOT}/scripts/start-all.sh >> ${LOG_FILE} 2>&1 &
sleep 15
nohup ${OPENIM_ROOT}/scripts/check-all.sh > ${LOG_FILE} 2>&1 &
nohup ${OPENIM_ROOT}/scripts/check-all.sh >> ${LOG_FILE} 2>&1 &
tail -f ${LOG_FILE}
-85
View File
@@ -1,85 +0,0 @@
#!/usr/bin/env bash
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Common utilities, variables and checks for all build scripts.
set -o errexit
set -o nounset
set -o pipefail
#Include shell font styles and some basic information
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source $SCRIPTS_ROOT/style_info.sh
# docker-compose.yaml file name
docker_compose_file_name="docker-compose.yaml"
trap 'onCtrlC' INT
function onCtrlC () {
#Capture CTRL+C, terminate the background process of the program when the script is terminated in the form of ctrl+c
kill -9 ${do_sth_pid} ${progress_pid}
echo
echo 'Ctrl+C is captured'
exit 1
}
# Load environment variables from .env file
source ${OPENIM_ROOT}/.env
# Get the public internet IP address
internet_ip=$(curl ifconfig.me -s)
echo -e "${PURPLE_PREFIX}=========> Your public internet IP address is ${internet_ip} ${COLOR_SUFFIX} \n"
# Replace local IP address with the public IP address in .env file
if [ $API_URL == "http://127.0.0.1:10002/object/" ]; then
sed -i "s/127.0.0.1/${internet_ip}/" ${OPENIM_ROOT}/.env
fi
if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then
sed -i "s/127.0.0.1/${internet_ip}/" ${OPENIM_ROOT}/.env
fi
echo -e "${PURPLE_PREFIX}=========> Your minio endpoint is ${MINIO_ENDPOINT} ${COLOR_SUFFIX} \n"
# Change directory to scripts folder
chmod +x ${SCRIPTS_ROOT}/*.sh
# Execute necessary scripts
echo -e "${PURPLE_PREFIX}=========> init_pwd.sh ${COLOR_SUFFIX} \n"
${SCRIPTS_ROOT}/init_pwd.sh
echo -e "${PURPLE_PREFIX}=========> env_check.sh ${COLOR_SUFFIX} \n"
${SCRIPTS_ROOT}/env_check.sh
# Go back to the previous directory
cd ${OPENIM_ROOT}
# Check if docker-compose command is available
if command -v docker-compose &> /dev/null
then
docker-compose up -d
else
docker compose up -d
fi
${SCRIPTS_ROOT}/docker-check-service.sh
+1 -1
View File
@@ -156,7 +156,7 @@ go.build.%:
.PHONY: go.install
go.install:
@echo "===========> Installing deployment openim"
@$(ROOT_DIR)/scripts/install_im_server.sh
@$(ROOT_DIR)/scripts/install-im-server.sh
## go.multiarch: Build multi-arch binaries
.PHONY: go.build.multiarch