美文网首页
vue docker部署

vue docker部署

作者: 王宣成 | 来源:发表于2021-12-08 01:52 被阅读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
    

    相关文章

      网友评论

          本文标题:vue docker部署

          本文链接:https://www.haomeiwen.com/subject/ulvaxrtx.html