Skip to main content

Easily build and run components with Dockerfile

Rainbond platformsupports building and running images directly throughDockerfile, the operation process is simple, and it is convenient for continuous iteration.

The operation process is divided into the following steps:

  1. CreatedDockerfileprojects onGithub,Demo projects

    create-repository

    Dockerfilecontent

    ARG VERSION=1.15.0
    FROM nginx:${VERSION}-alpine

    COPY index.html /usr/share/nginx/html/

    VOLUME /data
    EXPOSE 80
  2. Select the project to build through the source code build function of theRainbond platform

    create-demo

  3. Verify the mirror operation effect

    running

    nginx-page

Among them, the following points need to be paid to

  1. When Rainbond platformbuilds the source code, the language type is identified through the personalized files of different types of codes, so there must beDockerfilefiles in the specified directory of the project
  2. The build process is equivalent to executingdocker build -t image:tag .in the specified directory of the project (default is / directory), so you need to pay attention to the choice of relative paths when using modules such asCOPYandADDinDockerfile
  3. The daemon process of the mirror needs to be specified. If the daemon process is not specified, it will automatically exit and restart after the mirror startup command is completed, and the built components may be in an abnormal state.

advantages over normalDockerenvironment

For users who need to continuously adjustDockerfile, the build process is simpler. By referring toto configure components to automatically build and deploy, you can useGithubandWebhookto implement code modification and complete image update operations.