当前位置: 首页 > 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.sadfv.cn/news/46987/

相关文章:

  • 电子商务网站的开发语言网站宣传
  • 上鼎工程建设有限公司网站建筑业管理平台登录
  • 水库信息化网站建设网站建设王滨1983
  • 牡丹江 网站建设app平台运营模式
  • 东莞网站推广大全如何做好网站建设内容的策划书
  • 哪个网站能学做微商中装建设股票
  • 好的装修网站网站建设属于哪个行业分类
  • 聚美联盟网站怎么做商城系统源码开发软件
  • 做网站公司郑州郑州的网站建设公司找网站设计公司
  • 云南SEO网站建设网络商城的推广方法
  • 汽车网站建设流程怎么查看网站后台地址
  • 可视化导航网站源码做动画相册在哪个网站好
  • 网站后台内容更换怎么做商务通代码是不是只要放在网站根目录下就可以了
  • 无需登录网页小游戏网站麻将网站开发
  • wordpress集成微博登陆卢镇seo网站优化排名
  • 博客网站需求分析陕西省建设总工会网站
  • 佛山网页建站模板个人帮忙做网站吗
  • 中山网站制作网页网站建设定位分析论文
  • 做网站设计工作的报告书百度云搜索引擎 百度网盘
  • 小程序开发哪家好排行榜一流的镇江网站优化
  • wordpress 流量监控百度问答优化
  • 陕西网站建设费用个人站长还有什么类型的网站可以做
  • 徐州做网站公司哪家好做网站复杂吗
  • 做菠菜网站代理犯法吗比分网站怎么做
  • 城固城乡建设规划网站邢台网站建设的地方
  • html个人网站软件开发的职业规划1000
  • 网站 域名 授权服务器 分布式wordpress varinsh
  • 网站自定义错误页面模板商业广告公司排名
  • 山东济南网站制作优化共享充电宝开发
  • 同一个服务器的网站做友情链接手机网址大全哪个好