#!/bin/bash
###
 # @Date: 2022-08-18 09:19:07
 # @LastEditors: JinxChen
 # @LastEditTime: 2022-08-18 10:06:17
 # @FilePath: \TelpoH5FrontendWeb\setup_development.sh
 # @description:
###
npm -v
npm config set registry https://registry.npmmirror.com
npm install
npm run build-dev
image_version=`date +%Y%m%d%H%M`;
docker stop h5_frontend_web || true;
docker rm h5_frontend_web || true;
# 删除镜像
docker rmi -f $(docker images | grep telpo/h5_frontend_web | awk '{print $3}')
# 构建telpo/mrp:$image_version镜像
docker build --no-cache . -t telpo/h5_frontend_web:$image_version;
#删除产生的None镜像
docker rmi -f $(docker images | grep none | awk '{print $3}')
# 查看镜像列表
docker images;
docker run -p 8075:80 -d --restart=always --name h5_frontend_web telpo/h5_frontend_web:$image_version;
# 查看日志
docker logs h5_frontend_web;