我的 Dockerfile 波纹管构建成功:
FROM node:10-alpine
ENV VS_ENV prod
WORKDIR /var/www
COPY shims.d.ts ./
COPY tsconfig.json ./
COPY tsconfig-build.json ./
COPY package.json ./
COPY yarn.lock ./
COPY config ./config
COPY core ./core
COPY ecosystem.json ./
COPY .eslintignore ./
COPY .eslintrc.js ./
COPY lerna.json ./
COPY package.json ./
COPY src ./src
RUN apk add --virtual .build-deps ca-certificates wget python make g++ \
&& apk add git \
&& yarn install \
&& yarn build
然后我运行容器:
docker run -it -p 3000:3000 vue/sf:4a yarn start
日志显示,据我了解,该应用程序已启动:
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2][WARN] Applications server not running, starting...
[PM2] App [server] launched (4 instances)
┌──────────┬────┬─────────┬─────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├──────────┼────┼─────────┼─────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤
│ server │ 0 │ cluster │ 52 │ online │ 0 │ 0s │ 34% │ 72.5 MB │ root │ disabled │
│ server │ 1 │ cluster │ 59 │ online │ 0 │ 0s │ 28% │ 61.0 MB │ root │ disabled │
│ server │ 2 │ cluster │ 70 │ online │ 0 │ 0s │ 24% │ 35.3 MB │ root │ disabled │
│ server │ 3 │ cluster │ 81 │ online │ 0 │ 0s │ 20% │ 30.0 MB │ root │ disabled │
└──────────┴────┴─────────┴─────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
Done in 2.08s.
但是容器并没有像我预期的那样保持运行,而是以状态码 0 退出,所以没有错误:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8b77d6ffe26e vue/sf:4 "docker-entrypoint.s…" 11 minutes ago Exited (0) 11 minutes ago keen_raman
任何想法请我做错了什么?
谢谢