angularjs – 如何在Dockerfile中运行bower安装?

前端之家收集整理的这篇文章主要介绍了angularjs – 如何在Dockerfile中运行bower安装?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用go for后端和angular js作为我的应用程序的前端,并且能够运行前端我应该先运行bower安装.

注意:我正在从centos7基础图像构建我的图像.

我尝试将其添加到RUN命令中的docker文件

WORDIR ./Frontend
RUN bower install

我收到一个错误

/bin/sh: bower: command not found

有谁知道我怎么解决这个问题?

解决方法

这是如何使用centos为docker安装bower的完整示例

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

在此泊坞窗图像的构建阶段,您应该看到类似下面的内容.它表明(在构建阶段)您成功安装了bower.

尝试更改安装帮助,并添加docker命令 – 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

猜你在找的Angularjs相关文章