Use Dockerfile to Build and Run Components

Kato platform supports building and running images directly through Dockerfile. The operation process is simple and it is convenient for continuous iteration.

The operation process is divided into the following steps:

  1. Create a Dockerfile project on Github, Demo project

Dockerfile content

 FROM nginx:${VERSION}-alpine
 COPY index.html /usr/share/nginx/html/
 VOLUME /data
  1. Select the project to build through the source code build function of the Kato platform
  1. Verify the effect of mirroring

Among them, the following points need to be paid attention to:

  1. Kato platform is used to identify the language type through personalized files of different types of code when building source code, so there must be a Dockerfile file in the specified directory of the project
  2. The build process is equivalent to executing the docker build -t image:tag . operation in the project specified directory (default is / directory), so you need to pay attention when using modules such as COPY and ADD in Dockerfile Relative path selection
  3. You need to specify the daemon of the mirror. If you do not specify the daemon, it will automatically exit and restart after the mirror startup command is completed. The built component may be in an abnormal state.

Compared with ordinary Docker environment advantages:

For users who need to constantly adjust Dockerfile, the build process is simpler, by referring to Configuring component automatic build deployment You can use Webhook of Github to modify the code while completing the mirror update operation.