docker 封镜像-prom-api
#!/bin/bash Harbor_image="harbor-ioscar.cbf.com/cbf/prom_api:v2.${BUILD_ID}" cd $WORKSPACE ; mkdir prom-api; mv * ./prom-api ; tar -zcvf prometheus.tar prom-api/ cat > dockerfile <<end FROM harbor-ioscar.cbf.com/cbf/prom_api:v1 WORKDIR /django ADD ./prometheus.tar . RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime EXPOSE 80 #CMD ["python3","/django/prometheus/manage.py","runserver","0.0.0.0:80"] CMD ["python3","/django/prom-api/manage.py","runserver","0.0.0.0:80"] end docker build -t ${Harbor_image} . docker push ${Harbor_image} ssh 10.255.101.34 "kubectl -n ops set image deploy/prom-api prom-api=${Harbor_image}"