gpt4 book ai didi

docker - 在Docker上服务Vue js应用程序

转载 作者:行者123 更新时间:2023-12-02 20:02:50 25 4
gpt4 key购买 nike

我想将我的vueJs应用程序 jetty 化。在本地计算机上,我可以通过运行命令 npm install npm run serve 在本地主机上安装和提供服务。

我想创建一个docker镜像,所以我写了一个dockerfile。我的dockerfile看起来像这样

FROM Image_Name

WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["npm", "serve"]

但是我无法使用docker run命令运行我的docker镜像。知道我在做什么错。

运行run命令后-
Usage: npm <command>

where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
completion, config, create, ddp, dedupe, deprecate,
dist-tag, docs, doctor, edit, explore, get, help,
help-search, hook, i, init, install, install-test, it, link,
list, ln, login, logout, ls, outdated, owner, pack, ping,
prefix, profile, prune, publish, rb, rebuild, repo, restart,
root, run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami

npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview

Specify configs in the ini-formatted file:
/root/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.2.0 /usr/lib/node_modules/npm

最佳答案

当您尝试执行时npm run serve 你应该把
Dockerfile中的CMD ["npm", "run", "serve"]
您缺少run部分。

关于docker - 在Docker上服务Vue js应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52293159/

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