From 50174fce4b6e696600122bbc3b800b386842ffbd Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751@qq.com> Date: Sat, 19 Aug 2023 19:26:08 +0800 Subject: [PATCH] fix: chat scripts path bug (#152) * fix: chat scripts path bug Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * feat: add more sync scripts Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- .github/sync.yml | 26 ++++++++++++++++++++ .github/workflows/sync.yml | 40 +++++++++++++++++++++++++++++++ Dockerfile | 10 +++----- build/docker/api-admin/Dockerfile | 2 +- build/docker/api-chat/Dockerfile | 2 +- build/docker/rpc-admin/Dockerfile | 2 +- build/docker/rpc-chat/Dockerfile | 2 +- scripts/docker_start_all.sh | 4 ++-- 8 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 .github/sync.yml create mode 100644 .github/workflows/sync.yml diff --git a/.github/sync.yml b/.github/sync.yml new file mode 100644 index 000000000..7b718143b --- /dev/null +++ b/.github/sync.yml @@ -0,0 +1,26 @@ +# 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. + +# https://github.com/BetaHuhn/repo-file-sync-action +# Synchronization for the.github repository +openim-sigs/openim-docker: + - source: ./config + dest: ./openim-chat/config + replace: true + - source: ./docs + dest: ./openim-chat/docs + replace: true + - source: ./scripts + dest: ./openim-chat/scripts + replace: true diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 000000000..4d82375da --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,40 @@ +# Copyright © 2023 KubeCub open source community. All rights reserved. +# Licensed under the MIT License (the "License"); +# you may not use this file except in compliance with the License. + +# https://github.com/BetaHuhn/repo-file-sync-action +name: Synchronize kubecub public code to other repositories +on: + push: + branches: + - main + + workflow_dispatch: + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Run GitHub File Sync + uses: BetaHuhn/repo-file-sync-action@latest + with: + GH_INSTALLATION_TOKEN: "${{ secrets.BOT_GITHUB_TOKEN }}" + CONFIG_PATH: .github/sync.yml + ORIGINAL_MESSAGE: true + SKIP_PR: true + COMMIT_EACH_FILE: false + COMMIT_BODY: "🤖 kubbot to synchronize the warehouse" + GIT_EMAIL: "3293172751ysy@gmail.com" + GIT_USERNAME: "kubbot" + PR_BODY: 👌 kubecub provides automated community services + REVIEWERS: | + kubbot + cubxxw + PR_LABELS: | + file-sync + automerge + ASSIGNEES: | + kubbot \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 69469998f..6943257bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,14 +36,10 @@ RUN make clean RUN make build # Build the runtime stage -FROM ghcr.io/openim-sigs/openim-bash-image:latest +FROM ghcr.io/openim-sigs/openim-ubuntu-image:latest WORKDIR ${CHAT_WORKDIR} -COPY --from=builder ${CHAT_WORKDIR}/_output/bin/platforms /openim/openim-chat/_output/bin/platforms -COPY --from=builder ${OPENIM_CHAT_CMDDIR} /openim/openim-chat/scripts -COPY --from=builder ${OPENIM_CHAT_CONFIG_NAME} /openim/openim-chat/config/config.yaml +COPY --from=builder $OPENIM_CHAT_BINDIR/platforms /openim/openim-chat/_output/bin/platforms -VOLUME ["/openim/openim-chat/_output","/openim/openim-chat/logs","/openim/openim-chat/config","/openim/openim-chat/scripts"] - -CMD ["bash","-c", "${OPENIM_CHAT_CMDDIR}/docker_start_all.sh"] +CMD ["/openim/openim-chat/scripts/docker_start_all.sh"] \ No newline at end of file diff --git a/build/docker/api-admin/Dockerfile b/build/docker/api-admin/Dockerfile index 9056e16b6..a5bbcadf2 100644 --- a/build/docker/api-admin/Dockerfile +++ b/build/docker/api-admin/Dockerfile @@ -49,4 +49,4 @@ COPY --from=builder ${OPENIM_CHAT_CONFIG_NAME} /openim/openim-chat/config/config ENV PORT=10009 EXPOSE ${PORT} -CMD ["bash","-c","${OPENIM_CHAT_BINDIR}/platforms/${OS}/${ARCH}/admin-api --port ${PORT} --config_folder_path ${OPENIM_CHAT_CONFIG_NAME}"] +CMD ["bash","-c","${OPENIM_CHAT_BINDIR}/platforms/$(get_os)/$(get_arch)/admin-api --port ${PORT} --config_folder_path ${OPENIM_CHAT_CONFIG_NAME}"] diff --git a/build/docker/api-chat/Dockerfile b/build/docker/api-chat/Dockerfile index fd0ac1b00..f244a9f41 100644 --- a/build/docker/api-chat/Dockerfile +++ b/build/docker/api-chat/Dockerfile @@ -46,4 +46,4 @@ COPY --from=builder ${OPENIM_CHAT_CONFIG_NAME} /openim/openim-chat/config/config ENV PORT=10008 EXPOSE ${PORT} -CMD ["bash", "-c","${OPENIM_CHAT_BINDIR}/platforms/${OS}/${ARCH}/chat-api --port ${PORT} --config_folder_path ${OPENIM_CHAT_CONFIG_NAME}"] +CMD ["bash", "-c","${OPENIM_CHAT_BINDIR}/platforms/$(get_os)/$(get_arch)/chat-api --port ${PORT} --config_folder_path ${OPENIM_CHAT_CONFIG_NAME}"] diff --git a/build/docker/rpc-admin/Dockerfile b/build/docker/rpc-admin/Dockerfile index 035ac2a43..13c1c2d04 100644 --- a/build/docker/rpc-admin/Dockerfile +++ b/build/docker/rpc-admin/Dockerfile @@ -46,4 +46,4 @@ COPY --from=builder ${OPENIM_CHAT_CONFIG_NAME} /openim/openim-chat/config/config ENV PORT=30200 EXPOSE ${PORT} -CMD ["bash", "-c", "${OPENIM_CHAT_BINDIR}/platforms/${OS}/${ARCH}/admin-rpc --port ${PORT} --config_folder_path ${OPENIM_CHAT_CONFIG_NAME}"] +CMD ["bash", "-c", "${OPENIM_CHAT_BINDIR}/platforms/$(get_os)/$(get_arch)/admin-rpc --port ${PORT} --config_folder_path ${OPENIM_CHAT_CONFIG_NAME}"] diff --git a/build/docker/rpc-chat/Dockerfile b/build/docker/rpc-chat/Dockerfile index c3d7e88b7..62d80aeef 100644 --- a/build/docker/rpc-chat/Dockerfile +++ b/build/docker/rpc-chat/Dockerfile @@ -46,4 +46,4 @@ COPY --from=builder ${OPENIM_CHAT_CONFIG_NAME} /openim/openim-chat/config/config ENV PORT=30300 EXPOSE ${PORT} -CMD ["bash", "-c","${OPENIM_CHAT_BINDIR}/platforms/${OS}/${ARCH}/chat-rpc --port ${PORT} --config_folder_path ${OPENIM_CHAT_CONFIG_NAME}"] \ No newline at end of file +CMD ["bash", "-c","${OPENIM_CHAT_BINDIR}/platforms/$(get_os)/$(get_arch)/chat-rpc --port ${PORT} --config_folder_path ${OPENIM_CHAT_CONFIG_NAME}"] \ No newline at end of file diff --git a/scripts/docker_start_all.sh b/scripts/docker_start_all.sh index 21b2c6f87..5225b2dcc 100755 --- a/scripts/docker_start_all.sh +++ b/scripts/docker_start_all.sh @@ -80,7 +80,7 @@ for ((i = 0; i < ${#service_filenames[*]}; i++)); do service_ports=() for line in "${portList[@]}"; do if [[ $line == *"${service_port_names[$i]}"* ]]; then - port=$(echo "$line" | awk -F ':' '{print $NF}') + port=$(echo "$line" | awk -F '[ ]+' '{print $4} ') service_ports+=("$port") fi done @@ -93,7 +93,7 @@ for ((i = 0; i < ${#service_filenames[*]}; i++)); do cmd="$bin_dir/$service_name -port $port --config_folder_path $config_path" fi echo "$cmd" - nohup "$cmd" >> "${logs_dir}/openIM.log" 2>&1 & + nohup $cmd >> "${logs_dir}/openIM.log" 2>&1 & sleep 1 done done