Files
novolandWeb/Dockerfile
2022-06-15 11:30:19 +08:00

36 lines
959 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM node:lts-alpine as build-stage
# npm镜像解决报错而引入
RUN npm config set registry https://registry.npm.taobao.org \
&& npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
# install simple http server for serving static content
# 全局http-server用于本地运行
#RUN npm install -g http-server
# make the 'app' folder the current working directory
WORKDIR /app
# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./
# install project dependencies
RUN npm install
# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .
# build app for production with minification
RUN npm run build
# production stage
#代理nginxnginx直接访问
FROM caddy:alpine as production-stage
COPY --from=build-stage /app/dist /srv
EXPOSE 80
CMD ["caddy", "file-server", "--root", "/srv"]
#本地对应端口
#EXPOSE 8088
#CMD [ "http-server", "dist" ]