Commit 063cad25 authored by 金凯强's avatar 金凯强 🎨

镜像打包前,删除旧镜像

parent 84f46aab
......@@ -28,7 +28,10 @@ def install_runner(HSCUSCODE=None):
with open('/etc/gitlab-runner/config.toml', 'w') as f:
f.write(a)
s2 = os.system("sudo docker run -d --name gitlab-runner --restart always \
s1 = os.system("sudo docker stop gitlab-runner and docker rm gitlab-runner")
assert s1 == 0, "移除gitlab-runner失败"
s2 = os.system("sudo docker run --rm -d --name gitlab-runner --restart always \
-v /etc/gitlab-runner:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/profile.d/huansi.sh:/etc/profile.d/huansi.sh \
......@@ -54,6 +57,7 @@ def register_huansi_runner(HSCUSCODE):
--tag-list huansi.{hscode}".format(hscode=HSCUSCODE))
assert s1 == 0, "huansi_runner配置失败,如果要重新执行,不要再次执行init.py文件,请直接执行install_docker.py文件"
if __name__ == '__main__':
if os.path.exists('/etc/gitlab-runner'):
install_runner()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment