gpt4 book ai didi

Dockerfile 和问题使工作凉亭安装

转载 作者:行者123 更新时间:2023-12-04 21:38:01 25 4
gpt4 key购买 nike

我正在尝试执行 凉亭安装 节点:4.1.2 docker 容器 来自 dockerfile。

我的 dockerfile 的一部分是这样的:

#Install bower to command line
RUN npm install -g bower

# Define the host folder that will contain the code
WORKDIR /application

# Copy src to application host folder**
ADD . /application

# RUN move to /application/public/webapp where there is a bower.json file and install it**
RUN cd public/webapp && bower install --allow-root --config.interactive=false

ENTRYPOINT ["npm"]
CMD ["start"]

构建 它和 向上 它。

尽管显示:,但此 dockerfile 并未构建 bower_components 文件夹
Step 9 : RUN cd public/webapp && bower install --allow-root --config.interactive=false
---> Running in 937ad6c21887
/application/public/admintool
bower angular#1.4.7 not-cached git://github.com/angular/bower-angular.git#1.4.7
bower angular#1.4.7 resolve git://github.com/angular/bower-angular.git#1.4.7
bower angular#1.4.7 download https://github.com/angular/bower-angular/archive/v1.4.7.tar.gz
bower angular#1.4.7 extract archive.tar.gz
bower angular#1.4.7 resolved git://github.com/angular/bower-angular.git#1.4.7
bower angular#1.4.7 install angular#1.4.7

angular#1.4.7 bower_components/angular

如果我 进入容器,bower 被识别为命令 (它安装了它)。如果我在容器内,从/application/public/webapp 运行 bower install 可以工作。从 dockerfile 它只是不做任何事情。它也不提示。

有谁知道为什么?

最佳答案

您是否可能通过 docker-compose.yml 文件或 docker run 命令中的 -v 参数将卷从主机安装到容器中?

我问是因为你提到你的机器上没有安装 bower,所以你大概在你的代码库的主机副本中没有 bower_components 文件夹。如果您然后运行您的容器并将包含主机上源的卷安装到容器中,那么 bower_components 文件夹将会丢失,这解释了为什么它似乎从容器中消失了。

我将首先通过不从主机安装任何卷并查看 bower_components 文件夹是否在构建和运行容器后保留来测试这是否确实是问题。然后您可以在您的主机上安装 bower 并运行 bower install 以便在您进行开发时安装的卷不会引起问题。

关于Dockerfile 和问题使工作凉亭安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33369255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com