Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How Docker runs the Vue project

Shulou Source: shulou.com Published: 2022-06-02 07:35:37 10月01日 Update

This article focuses on "how Docker runs the Vue project". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how Docker runs the Vue project.

I am not the front end, only for deployment. The content of Dockfile mainly comes from the official Vue: https://cn.vuejs.org/v2/cookbook/dockerize-vuejs-app.html

Go directly to Dockerfile, almost the same as the official one, but the details above have been configured to be closer to the actual use. For more information, please see Dockerfile:

FROM node:lts-alpine# if you are in China, this line configuration is very necessary, otherwise packing will be very slow, the reasons, all understand. RUN npm config set registry https://registry.npm.taobao.org# install simple http server for serving static contentRUN npm install-g http-server# make the 'app' folder the current working directoryWORKDIR / app# copy both' package.json' and 'package-lock.json' (if available) COPY package*.json. / # install project dependenciesRUN npm install# copy project files and folders to the current working directory (i.e.' app' folder) COPY. . # build app for production with minificationRUN npm run build:prodEXPOSE 900 adds port custom configuration to avoid CMD conflicts with other K8S container ports ["http-server", "- p", "9000", "dist"]

Build a Docker image:

Docker build-t registry.cn-hangzhou.aliyuncs.com/xxx/xxx.

Test image availability:

Docker run-p 80 9000-- rm registry.cn-hangzhou.aliyuncs.com/xxx/xxx

At this point, I believe you have a deeper understanding of "how Docker runs the Vue project". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Content project run configuration official actual port mirror learning practical deeper necessary interest front-end reason just availability practicality container simple operation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Xiaomi MySQL Shulou Tech Info Apple