Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker+daocloud implements automatic construction and deployment of front-end projects

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail about the automatic construction and deployment of docker+daocloud front-end projects, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Initialize a project through vue-cli

You can initialize a project with the vue init webpack project name, assuming that the project name is docker-vue, and then create a new Dockerfile file in the root directory of the project, as follows:

FROM nginx:latest# copies the html of the current packaged project to the virtual address COPY dist/ / usr/share/nginx/html/# using a custom nginx.conf configuration port and listens to RUN rm / etc/nginx/conf.d/default.confADD default.conf / etc/nginx/conf.d/RUN / bin/bash-c 'echo init okshelf configurations

And create a new default.conf file with the following contents:

The port number defined in the server {# project is listen 8080 position serveraccounname localhost;#charset koi8-r;#access_log / var/log/nginx/log/host.access.log main;location / {root / usr/share/nginx/html; index index.html index.htm;} # error_page 404 / 404.htmlash # redirect server error pages to the static page / 50x.html#error_page 500502 503 504 / 50x.htmlmitlocation = / 50x.html {root html;}}

Since then, the basic work has been done, and the next step is the basic configuration of daocloud.io.

Daocloud.io basic configuration operation

If you don't have an account, you can register for daocloud.io first.

The next operation is as follows:

Create a project

Cluster management

Create an image repository

Create a project

Here you need to add the project name, set the code source (can be github, gitlab), etc., and then select the project you want to build. I chose my own github repository docker-vue here, and then click start to create.

Cluster management

The main purpose of cluster management is to link to remote servers and create daocloud.io images through commands.

Select New Host

Since I bought the Ali cloud server myself, and the system is ubuntu, I chose this configuration and ran it on the server:

Curl-sSL https://get.daocloud.io/daomonit/install.sh | sh-s e2fa03ebead51076411388c26dff2257dae89768

To build a docker image, such as:

The host is created successfully, as shown in the following figure:

Create an image repository

Go to [Image Warehouse] and select the image you just built manually, and deploy the latest version to the free host or cloud test environment.

Then apply the following settings:

Once the deployment is complete, it can be accessed through the container port number just set by the server ip+.

In this way, we have completed most of the operations. By looking at the docker container, we can see that after we have successfully created the image repository, we have automatically created a container:

So much for the automatic construction and deployment of the docker+daocloud front-end project. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report