Docker 内部因 NPM 问题而爆发战争

Docker 内部因 NPM 问题而爆发战争

使用 Docker 制作 war 文件并附加到 Apache Tomcat。

努力使用 NPM/MVN 来启动 Tomcat。

我使用公司代理,并且 make 脚本没有“bower install --allow-root”(查找后意识到)。

众所周知,Docker 以 root 身份运行所有操作,因此我遇到了以下错误。

     [echo] --- BOWER INSTALL ---
     [exec] 
     [exec] /usr/local/lib/node_modules/bower/lib/node_modules/bower-config/lib/util/rc.js:71
     [exec]         throw error;
     [exec]               ^
     [exec] Error: Unable to parse /root/.bowerrc: Unexpected token }
     [exec]     at parse (/usr/local/lib/node_modules/bower/lib/node_modules/bower-config/lib/util/rc.js:64:21)
     [exec]     at json (/usr/local/lib/node_modules/bower/lib/node_modules/bower-config/lib/util/rc.js:86:16)
     [exec]     at rc (/usr/local/lib/node_modules/bower/lib/node_modules/bower-config/lib/util/rc.js:32:26)
     [exec]     at Config.load (/usr/local/lib/node_modules/bower/lib/node_modules/bower-config/lib/Config.js:16:20)
     [exec]     at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:15:39)
     [exec]     at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:12)
     [exec]     at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:16:32)
     [exec]     at Module._compile (module.js:456:26)
     [exec]     at Object.Module._extensions..js (module.js:474:10)
     [exec]     at Module.load (module.js:356:32)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:30.433s
[INFO] Finished at: Thu Feb 04 16:15:59 UTC 2016
[INFO] Final Memory: 13M/1928M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.5:run (exec-gen-sources) on project gui-uxd-container: An Ant BuildException has occured: exec returned: 8 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The command '/bin/sh -c cd /var/opt/gui/gui-uxd-container && sudo mvn clean install' returned a non-zero code: 1
root@docker:~/war-Docker/gui# 

由于我无法接触源代码,因此在调用命令之前,我通过 Dockerfile 中的“COPY .bowerrc /root/.bowerrc”做出了调整。

我的 .bowerrc 语法看起来没问题吗?如果没问题,这是我的错误信息抛出的主要问题吗?我不想更改默认项目文件夹

{
    "proxy":"http://proxy.wsa.com:8000",
    "https-proxy":"http://proxy.wsa.com:8000",
    "strict-ssl": false,
    "allow_root": true
}

非常感谢您的帮助。

答案1

“耐心是一种美德”

依赖项尚未完全准备好。代理...和代理

RUN locale-gen en_US.UTF-8
RUN dpkg-reconfigure locales

ENV JAVA_HOME /usr/lib/jvm/java-1.7.0-openjdk-amd64

ENV PATH /root/.linuxbrew/bin:$PATH
ENV MANPATH /root/.linuxbrew/share/man:$MANPATH
ENV INFOPATH /root/.linuxbrew/share/info:$INFOPATH

COPY settings.xml ~/.m2/settings.xml
COPY .bowerrc /root/tomcat-war/.bowerrc


root@~/tomcat-war# cat .bowerrc 
{
    "directory":"app/bower_components",
    "proxy":"http://proxy.wsa.com:8000",
    "https-proxy":"http://proxy.wsa.com:8000",
    "strict-ssl": false,
    "allow_root": true
}
root@~/tomcat-war# 

root@~/tomcat-war#  cat settings.xml | grep proxy
   | Unless otherwise specified (by system property or command-line switch), the first proxy
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
    <proxy>
      <host>http://proxy.wsa.com:8000</host>
    </proxy>
   | Unless otherwise specified (by system property or command-line switch), the first proxy
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
    <proxy>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
    </proxy>
root@~/tomcat-war# 

相关内容