Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Cannot read property 'split' of undefined #6

Open
scriptwang opened this issue Mar 22, 2022 · 0 comments
Open

Cannot read property 'split' of undefined #6

scriptwang opened this issue Mar 22, 2022 · 0 comments

Comments

@scriptwang
Copy link

你好,我在扫描红帽官方镜像的时候registry.redhat.io/rhscl/nodejs-14-rhel7:1-51
前端页面有一个bug,应该是解析命令行的时候没做空判断
image

修正如下

if (typeof(text) != 'undefined'){
      text.split(";").forEach(function(value) {
        const tmpResult = [];
        value.split("&&").forEach(function(item) {
          if (item) {
            tmpResult.push(item);
          }
        });
        if (tmpResult.length) {
          result.push(tmpResult.join("&& \\ \n"));
        }
      });
    }

另外建议国内构构建的朋友可以在dockerfile中增加镜像源,否则出奇的慢。。。

FROM node:16-alpine as webbuilder

ADD ./ /diving

RUN cd /diving/web \
  && npm config set registry https://registry.npm.taobao.org \       # 增加 npm国内镜像源
  && npm i \
  && npm run build \
  && rm -rf node_module

FROM golang:1.17-alpine as builder

COPY --from=webbuilder /diving /diving

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \  # APK增加 国内镜像源
  && apk update \
  && apk add docker git gcc make \
  && cd /diving \
  && rm -rf asset/dist \
  && cp -rf web/build asset/dist \
  && make build

FROM alpine 

EXPOSE 7001

COPY --from=builder /usr/bin/docker /usr/bin/docker
COPY --from=builder /diving/diving /usr/local/bin/diving
COPY --from=builder /diving/entrypoint.sh /entrypoint.sh

CMD ["diving"]

ENTRYPOINT ["/entrypoint.sh"]

HEALTHCHECK --interval=10s --timeout=3s \
  CMD diving --mode=check || exit 1

最后谢谢作者开发的项目

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant