【发布时间】:2018-06-17 07:45:39
【问题描述】:
The build folder is ready to be deployed.
You may serve it with a static server:
serve -s build
---> b252a9088991
Removing intermediate container cb5c1e2629c9
Step 16/16 : RUN serve -s build
---> Running in c27b54b31108
serve: Running on port 5000
使用 react-app 创建和 dockerized react 应用程序,并在“docker-compose up”命令中获得类似上面的输出 但http://0.0.0.0:5000/ 或 http://localhost:5000/ 上没有显示任何内容
version: '3'
services:
web:
build: .
image: react-cli
container_name: react-cli
volumes:
- .:/app
ports:
- '3000:3000'
在我的 docker-compose.yml 文件上方
FROM scratch
FROM mhart/alpine-node:6.12.0
RUN npm install -g npm --prefix=/usr/local
RUN ln -s -f /usr/local/bin/npm /usr/bin/npm
CMD [ "/bin/sh" ]
ENV NPM_CONFIG_LOGLEVEL warn
RUN npm install -g serve
CMD serve -s build
EXPOSE 3000
COPY package.json package.json
COPY semantic.json semantic.json
COPY npm-shrinkwrap.json npm-shrinkwrap.json
RUN npm install gulp-header --save-dev
RUN npm install --no-optional
COPY . .
RUN npm run build --production
RUN serve -s build
这是我的 Dockerfile
【问题讨论】: