修改源码后,在打包镜像时需要重新build:
如果有新引入的包,则需要copy到vender目录下,如引入了go-sql-driver
build之前
1.需要安装node.js
centos7 安装
curl -sL https://rpm.nodesource.com/setup_10.x | bash -
yum install -y nodejs
node -v
2.需要安装yarn
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
sudo yum install yarn
yarn --version
3.make npm_licenses #生成npm_licenses.tar.bz2文件
build:
make build
生成prometheus和promtool两个文件(用于打包镜像,dockerfile中使用)
#COPY .build/
O
S
−
{OS}-
OS−{ARCH}/prometheus /bin/prometheus
#COPY .build/
O
S
−
{OS}-
OS−{ARCH}/promtool /bin/promtool
COPY ./prometheus /bin/prometheus
COPY ./promtool /bin/promtool
dockerfile中copy的路径是prometheus和promtool所在的路径