2016-10-04 177 views
1

我正在使用go作为我的应用程序前端的后端和角度js,并且能够运行前端,因此我应该先运行bower安装。如何在Dockerfile中运行bower安装?

注意:我从一个centos7基础图像构建我的图像。

我试图在运行命令将其添加在泊坞窗文件,因为这

WORDIR ./Frontend 
RUN bower install 

我得到了一个错误:

/bin/sh: bower: command not found 

是否有人知道我怎么能解决这个问题?

+0

它看起来像'bower'没有安装在你的搬运工图像 – Rudis

+0

@Rudis肯定的,但如何能如果我使用的是centos7基本映像,我会安装它吗? – user6638204

+0

如何在centos7上安装bower描述http://stackoverflow.com/a/32724832/1214948 – Rudis

回答

1

这是完整的例子如何为码头工人在CentOS

安装凉亭Dockerfile

FROM centos 

RUN useradd -ms /bin/bash bower 
RUN yum install -y gcc-c++ make 
RUN curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - 
RUN yum install -y nodejs 

# install bower 
RUN npm install --global bower 

USER bower 

#this should show bower help - try to use install instead 
RUN bower help 

,并在建筑这个码头形象的阶段,你应该看到像下面这样的东西。它表明(在构建阶段)您已成功安装凉亭。

试图改变帮助安装也可以增加你的泊坞窗命令 - WORDIR ./Frontend

Step 8 : RUN bower help 
---> Running in 2afd81510166 
Usage: 
bower <command> [<args>] [<options>] 
Commands: 
cache     Manage bower cache 
help     Display help information about Bower 
home     Opens a package homepage into your favorite browser 
3

你应该哈弗看看https://github.com/marmelab/docker-bower/blob/master/Dockerfile

我看,除其他事项外

的所有您需要检查鲍尔是在全球范围内您的机器或没有安装
RUN apt-get install -y -qq npm 

RUN ln -s /usr/bin/nodejs /usr/bin/node 

# install bower 

RUN npm install --global bower 
+0

谢谢我从centos7基础映像中创建我的映像,并且我没有安装apt,因此我正在使用apt-找不到命令。你知道我该怎么做? – user6638204

+0

如果您不知道centos,请使用ubuntu作为基础映像! Centos使用“yum”作为“apt-get”,应该类似地工作。 –

1

第一? 比你可以安装包与凉亭。

则可以安装带有命令: NPM安装凉亭-g