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
创建和dockerized使用react-app反应应用程序并获得如上所述的输出" 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
答案 0 :(得分:1)
很可能您没有在主机上公开容器端口。我没看到你的撰写文件看起来如何,但你可能需要添加
ports:
- "5000:5000"
撰写文件中的容器定义。