当前位置: 首页 > news >正文

做医采官方网站网站建设mus18

做医采官方网站,网站建设mus18,品牌策略的7种类型,做外贸如何建网站新冠疫情自我检测系统网页设计开发文档 Sylvan Ding 的第一个基于 Vue.js 的项目. 本项目所提供的信息#xff0c;只供参考之用#xff0c;不保证信息的准确性、有效性、及时性和完整性#xff0c;更多内容请查看国家卫健委网站#xff01; Explore the docs View Demo… 新冠疫情自我检测系统网页设计开发文档 Sylvan Ding 的第一个基于 Vue.js 的项目. 本项目所提供的信息只供参考之用不保证信息的准确性、有效性、及时性和完整性更多内容请查看国家卫健委网站 Explore the docs » View Demo · Report Bug · Request Feature 在Docker中运行Vue.js项目开发环境/生产环境 Next, we will run our Vue.js app in a Docker container. Environment Ubuntu18.04.4Docker20.10.18Docker Compose2.10.2 Installation # Install using the convenience script curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh --mirror Aliyun docker -v # 20.10.18 docker compose version # 2.10.2 # Change registry mirrors vim /etc/docker/daemon.json # input the following JSON: {registry-mirrors: [https://docker.mirrors.ustc.edu.cn/, https://registry.docker-cn.com]} sudo systemctl daemon-reload sudo systemctl restart docker docker info # Registry Mirrors: # https://docker.mirrors.ustc.edu.cn/ # https://registry.docker-cn.com/ sudo docker run hello-world # Unable to find image hello-world:latest locally # latest: Pulling from library/hello-world # 2db29710123e: Pull complete # Status: Downloaded newer image for hello-world:latest # Hello from Docker! # This message shows that your installation appears to be working correctly.Build Images and Run Containers of Vue.js App We create Dockerfile for both ‘dev’ and ‘prod’ environment in the root folder of our project. Add a .dockerignore to speed up the Docker build process as our local dependencies and git repo will not be sent to the Docker daemon. docs images README.md .prettierrc node_modules .git .gitignore static/.gitkeepDev We start by creating a Dockerfile.dev in the root folder of our project: # Dockerfile.devFROM node:14.16.1WORKDIR /app# add /app/node_modules/.bin to $PATH ENV PATH /app/node_modules/.bin:$PATH# overwrite Dev Server settings host in config/index.js ENV HOST 0.0.0.0# copy both package.json and package-lock.json (if available) COPY package*.json ./# copy patches before npm runs post-install script COPY patches ./patches# update npm and install project dependencies RUN npm i npm8.18.0 -g RUN npm i vue-cli -g --legacy-peer-deps RUN npm install --legacy-peer-depsEXPOSE 8080# configure anonymous volume in order to # use the container version of the “node_modules” folder VOLUME /app/node_modulesCMD [npm, run, dev]ENV HOST 0.0.0.0 sets the environment variable HOST to the value 0.0.0.0, which overwrites Dev Server settings host in config/index.js. If you keep original settings host: localhost, our Vue.js app in a docker container will not be accessible from outside. By inspecting container exposed port docker container port dockerize-vuejs-app-dev, we get the output 8080/tcp - 0.0.0.0:8080, which means the docker container are listening to inner port 0.0.0.0:8080 instead of localhost:8080. To be more specific, when apps run in a Docker container the IP 127.0.0.1 is assigned to the Docker container, not the host. Changing it to 0.0.0.0 will allow us to directly access the app from the host. COPY patches ./patches aims at providing patches before npm runs post-install script. After patching, you will get the output: Applying patches... element-ui2.15.9 ✔. It may seem reduntant to first copy package.json and package-lock.json and then all project files and folders in two separate steps but there is actually a very good reason for that (spoiler: it allows us to take advantage of cached Docker layers). Now let’s build the Docker image of our Vue.js app: docker build -f Dockerfile.dev -t dockerize-vuejs-app:dev .Finally, let’s run our Vue.js app in a Docker container: docker run -it -p 8080:8080 -v ${PWD}:/app --rm --name dockerize-vuejs-app-dev dockerize-vuejs-app:dev-v ${PWD}:/app mounts our code into the container at “/app” to enable “Hot Reload”. ${PWD} is /path/to/your/project, which may not work on Windows. ( See this Stack Overflow question for more info. ) You should be able to access our Vue.js app on localhost:8080 on your host machine. The logs are as follows: DONE Compiled successfully in 12336ms 3:04:24 AMI Your application is running here: http://0.0.0.0:8080I Your Express app is listening on port 8081N © Sylvan Ding 2022 sylvandingqq.comN https://github.com/sylvanding/Prod For realistically complex production use cases, it may be wiser to stand on the shoulders of some giant like NGINX or Apache and that is exactly what we are going to do next: we are about to leverage NGINX to serve our Vue.js app because it is considered to be one of the most performant and battle-tested solutions out there. We refactor our Dockerfile.dev to use NGINX: # Dockerfile.prod# build stage FROM node:14.16.1 as build-stage WORKDIR /app ENV PATH /app/node_modules/.bin:$PATH COPY package*.json ./ COPY patches ./patches RUN npm i npm8.18.0 -g RUN npm i vue-cli -g --legacy-peer-deps RUN npm install --legacy-peer-deps COPY . . RUN npm run build# production stage FROM nginx:stable-alpine as production-stage COPY --frombuild-stage /app/dist /usr/share/nginx/html EXPOSE 80CMD [nginx, -g, daemon off;]Now let’s build the Docker image of our Vue.js app: docker build -f Dockerfile.prod -t dockerize-vuejs-app:prod .Finally, let’s run our Vue.js app in a Docker container: docker run -it -p 80:80 --rm --name dockerize-vuejs-app-prod dockerize-vuejs-app:prodWe should be able to access our Vue.js app on http://localhost or http://yourPublibIPAddress. Note that you need to open 80 port in your firewall. To run a container in background, we use -d flag instead of --rm: docker run -d -p 80:80 --name dockerize-vuejs-app-prod dockerize-vuejs-app:prodStop and remove that container: docker rm -f dockerize-vuejs-app-prodView Nginx Access Logs Type the following command helps us view Nginx real-time access logs shown on the background container’s virtual screen: docker attach --sig-proxyfalse dockerize-vuejs-app-prodWhat happens there? docker attach attaches your terminal’s standard input, output, and error (or any combination of the three) to a running container using the container’s ID or name. This allows you to view its ongoing output or to control it interactively, as though the commands were running directly in your terminal.--sig-proxyfalse prevents CTRL-c from sending a SIGINT to the container. It allows you to detach from the container with a -d flag and leave it running Nginx continuously by using the CTRL-c key sequence. 转载请注明出处©️ Sylvan Ding 2022
http://www.huolong8.cn/news/46987/

相关文章:

  • 企业网站规划案例企业自己怎么做网站推广
  • 南宁网站制作工具如何管理wordpress网站模板下载
  • 做自己的网站怎么赚钱经营地址怎么在国税网站做更改
  • 免费查企业app排行榜网络优化排名培训
  • 分析对手网站的优化方法赣icp网站建设
  • 国外网站开发技术现状阿里巴巴与慧聪网网站建设对比
  • 网站建设可以自学吗网络规划设计师教程最新版
  • 做线下活动的网站做网站的知名公司
  • 动态ip可以做网站域名检测
  • 企业大型网站开发需要多少钱广西玉林网站建设正规公司
  • 旌阳移动网站建设加强文明网站建设
  • 洛阳制作网站的公司顺义公司网站建设
  • wordpress开放哪个端口企业网站优化怎么做
  • 杭州设计公司网站排名辽宁建设工程信息网网站
  • 淘宝上有做网站的吗wordpress用户名怎么设置密码
  • 无锡网站制作启电商网站建设 平台
  • 网站免费建站ppa如何建设一个不备案的网站
  • 网站建设教程网页泾县网站建设
  • 浙江网站建设 seowordpress4.1.12 漏洞
  • 网站建设大作业厦门微信网站建
  • 郑州网站seo多少钱seo培训中心
  • linux做网站网络课堂网站建设京icp备
  • 做国外网站青岛外贸网站运营哪家好
  • 用文件传输协议登录网站中小型网站建设怎么样
  • 国外做设备网站wordpress 做的官网
  • 如何在vps上建设网站vs建设网站
  • o2o苗木网站建设百度网址入口
  • 高职图书馆网站建设大赛买虚机送网站建设
  • 网站建设百度搜不到网站建设代理
  • 南京网站排名公司梧州吧