echo 'server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
add_header Cache-Control 'no-cache';
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}' > nginx.default.conf
touch Dockerfile
cat > Dockerfile <<EOF
FROM bu-hub.deepexi.com/public/node:18.12.1 as builder
LABEL stage=nodebuilder
RUN mkdir /frontend_web
WORKDIR /frontend_web
ADD . /frontend_web
RUN npm config set registry https://registry.npmmirror.com/
RUN npm i pnpm -g
RUN pnpm i
RUN pnpm run uatebuild
FROM bu-hub.deepexi.com/public/nginx:1.23.2
WORKDIR /usr/share/nginx/html
COPY --from=builder /frontend_web/packages/enterprise/dist ./scd-footprint-enterprise
RUN rm -rf /frontend_web/packages/enterprise/dist
COPY --from=builder /frontend_web/server/uat.conf /etc/nginx/conf.d
EOF
touch Dockerfile
cat > Dockerfile <<EOF
FROM deploy.deepexi.com/dce-uat/node:sass as builder
LABEL stage=nodebuilder
RUN mkdir /frontend_web
WORKDIR /frontend_web
RUN yarn config set ignore-engines true
ADD package.json yarn.lock /frontend_web/
ADD ./runner-docker/ /frontend_web/
RUN yarn
ADD . /frontend_web
RUN yarn uat:build
FROM bu-hub.deepexi.com/public/nginx:1.23.2
WORKDIR /usr/share/nginx/html
COPY --from=builder /frontend_web/dist ./scd-footprint-accounting
COPY --from=builder /frontend_web/runner-docker/uat.conf /etc/nginx/conf.d
COPY --from=builder /frontend_web/runner-docker/upstream.conf /etc/nginx/conf.d
EOF
time=$(date +%Y%m%d%H%M)
# time=$(date "+%Y-%m-%d %H:%M:%S")
docker login -u chenxing -p iRd5FJqAdP deploy.deepexi.com
docker build -t deploy.deepexi.com/jinjiang/web-accounting:${time} .
docker push deploy.deepexi.com/jinjiang/web-accounting:${time}
docker rmi -f deploy.deepexi.com/jinjiang/web-accounting:${time}
docker image prune --filter label=stage=nodebuilder -f
docker logout deploy.deepexi.com