[PATCH compass-ci 4/6] container/webhook: start

Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- container/webhook/start | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 container/webhook/start diff --git a/container/webhook/start b/container/webhook/start new file mode 100755 index 0000000..50cbf20 --- /dev/null +++ b/container/webhook/start @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true + +require_relative '../defconfig.rb' + +docker_rm "webhook" + +cmd = %W[ + docker run + --restart=always + --name webhook + -d + -p 11301:11301 + node:webhook +] + +cmd += ['sh', '-c', 'node webhook.js'] +system(*cmd) -- 2.23.0

On Thu, Nov 05, 2020 at 03:08:21PM +0800, Li Yuanchao wrote:
Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- container/webhook/start | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 container/webhook/start
diff --git a/container/webhook/start b/container/webhook/start new file mode 100755 index 0000000..50cbf20 --- /dev/null +++ b/container/webhook/start @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true + +require_relative '../defconfig.rb'
It is best to avoid relative paths for scripts that need to be executed manually. If people run './webhook/start' in container directory, it will not be found '../defconfig.rb' require 'pathname' SCRIPT_DIR = Pathname.new(File.dirname(__FILE__)).realpath LIB_DIR = File.dirname(SCRIPT_DIR) + '/defconfig.rb' require_relative LIB_DIR.to_s Thanks, Chenglong
+ +docker_rm "webhook" + +cmd = %W[ + docker run + --restart=always + --name webhook + -d + -p 11301:11301 + node:webhook +] + +cmd += ['sh', '-c', 'node webhook.js'] +system(*cmd) -- 2.23.0

On Thu, Nov 05, 2020 at 03:22:18PM +0800, Wang Chenglong wrote:
On Thu, Nov 05, 2020 at 03:08:21PM +0800, Li Yuanchao wrote:
Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- container/webhook/start | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 container/webhook/start
diff --git a/container/webhook/start b/container/webhook/start new file mode 100755 index 0000000..50cbf20 --- /dev/null +++ b/container/webhook/start @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true + +require_relative '../defconfig.rb'
It is best to avoid relative paths for scripts that need to be executed manually. If people run './webhook/start' in container directory, it will not be found '../defconfig.rb'
I tried './webhook/start', it works well Thanks, Yuanchao
participants (2)
-
Li Yuanchao
-
Wang Chenglong