基于nginx docker 构建镜像

This commit is contained in:
2021-06-06 10:37:12 +08:00
parent 74afe6fdd9
commit 547d96ea2c
4 changed files with 32 additions and 18 deletions

View File

@@ -1,16 +1,21 @@
FROM node:lts
FROM node:lts as dist
WORKDIR /src
COPY . .
RUN yarn global add http-server && \
npm install pm2 -g && \
yarn && \
RUN yarn && \
yarn build:prod
FROM nginx:1.19.2
WORKDIR /app
COPY --from=dist /src/dist .
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
# CMD ["http-server","/src/dist","-p","80"]
CMD ["bash","http.sh"]
CMD ["nginx","-g","daemon off;"]