


Use docker to automatically deploy to your own host based on daocloud
In front-end development, deploying projects is something that often happens to us. This article mainly talks about how to deploy vue projects elegantly, using docker containers and git webhook hooks. When we trigger the git hook event, we will deploy automatically. . Of course the suggestion here is the tag event.
Here I have finished writing the basic files of the project, you only need to copy this project to your vue project!
Project address docker vue project
Instructions for use
<span style="font-size: 16px;">git clone https://github.com/devdocker/dao-vue<br><br>cp -r dao-vue vueitem<br><br>vueitem 是你的vue项目地址<br></span>
At this time your project file structure
##Then go to the daocloud.io official website to create a new project based on this project
If you don’t know daocloud.io, it doesn’t matter, just register and read the documentation. I will write detailed documentation about daocloud.io in the future.
If you have used daocloud, please create a project, compile and publish, set trigger conditions, and automatically publish to your host. Of course, after deploying it to your server, write down the port and don’t make it dynamic.
Then you can use nginx upstream proxy_pass reverse proxy to solve cross-domain problems
The configuration is as follows
<span style="font-size: 16px;">upstream webfenxi {<br> server 127.0.0.1:8083; # 这是服务器使用docker启动的端口<br>}<br>server<br> {<br> listen 80;<br> #listen [::]:80;<br> server_name webfenxi.com ; # 这是绑定的自己的域名<br> index index.html index.htm index.php default.html default.htm default.php;<br> root /home/wwwroot/webfenxi.com;<br><br> include other.conf;<br> #error_page 404 /404.html;<br><br> # Deny access to PHP files in specific directory<br> #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }<br><br> include enable-php.conf;<br><br> location / {<br> proxy_set_header X-Real-Ip $remote_addr;<br> proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;<br><br> proxy_set_header X-Nginx-Proxy true;<br> proxy_pass http://webfenxi; # 代理地址<br> proxy_redirect off;<br> # try_files $uri $uri/ /index.html;<br> }<br><br> location /v1/ {<br> proxy_pass http://api.xxxx.com/v1/; #代理的接口,解决跨域问题<br> }<br><br> location ~ /.well-known {<br> allow all;<br> }<br><br> location ~ /\.<br> {<br> deny all;<br> }<br><br> access_log /home/wwwlogs/webfenxi.com.log;<br> }<br></span>
How to use Docker to deploy a PHP development environment
How to use Docker to build a Laravel environment
##docker Simple example of installing mysqlThe above is the detailed content of Use docker to automatically deploy to your own host based on daocloud. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Four ways to exit Docker container: Use Ctrl D in the container terminal Enter exit command in the container terminal Use docker stop <container_name> Command Use docker kill <container_name> command in the host terminal (force exit)

Methods for copying files to external hosts in Docker: Use the docker cp command: Execute docker cp [Options] <Container Path> <Host Path>. Using data volumes: Create a directory on the host, and use the -v parameter to mount the directory into the container when creating the container to achieve bidirectional file synchronization.

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to restart the Docker container: get the container ID (docker ps); stop the container (docker stop <container_id>); start the container (docker start <container_id>); verify that the restart is successful (docker ps). Other methods: Docker Compose (docker-compose restart) or Docker API (see Docker documentation).

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

The steps to update a Docker image are as follows: Pull the latest image tag New image Delete the old image for a specific tag (optional) Restart the container (if needed)

Docker process viewing method: 1. Docker CLI command: docker ps; 2. Systemd CLI command: systemctl status docker; 3. Docker Compose CLI command: docker-compose ps; 4. Process Explorer (Windows); 5. /proc directory (Linux).

You can switch to the domestic mirror source. The steps are as follows: 1. Edit the configuration file /etc/docker/daemon.json and add the mirror source address; 2. After saving and exiting, restart the Docker service sudo systemctl restart docker to improve the image download speed and stability.
