vue docker部署
2021-12-08 本文已影响0人
王宣成
1、根目录下新建文件 Dockerfile
FROM node:lts-alpine
MAINTAINER Rethink
RUN echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.4/main/" > /etc/apk/repositories
RUN apk update \
&& apk upgrade \
&& apk add --no-cache bash \
bash-doc \
bash-completion \
&& rm -rf /var/cache/apk/* \
&& /bin/bash
# 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 . .
EXPOSE 9526
RUN npm run build:prod
ENTRYPOINT ["/bin/bash"]
2、编译
docker build -t dockerize-vuejs-app .
3、运行
docker run -itd -p 9526:9526 -v /www/wwwroot/gf/html/:/app/dist/ --name dockerize-vuejs-app- dockerize-vuejs-app