【发布时间】:2019-05-17 22:52:20
【问题描述】:
我为 React 创建了一个网站,并尝试使用 Docker 将其部署到 Nginx 服务器。我的 Dockerfile 位于项目的根文件夹中,如下所示:
FROM tiangolo/node-frontend:10 as build-stage
WORKDIR /app
COPY . ./
RUN yarn run build
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.15
COPY --from=build-stage /app/build/ /usr/share/nginx/html
# Copy the default nginx.conf provided by tiangolo/node-frontend
COPY --from=build-stage /nginx.conf /etc/nginx/conf.d/default.conf
当我在 docker 终端上运行 docker build -t mywebsite . 时,我收到一个小警告,说我正在从 windows 针对非 windows Docker 主机构建 docker 映像,但这似乎不是问题。
但是,当我运行 docker run mywebsite 时,什么都没有发生。
如果有必要,我的项目网站托管在 GitHub 上:https://github.com/rgomez96/Tecnolab
【问题讨论】: