github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/docs/site/src/zh/reference/kubefile.md (about)

     1  # Kubefile instruction
     2  
     3  A `Kubefile` is a text document that contains all the commands a user could call on the command line to assemble an
     4  image.We can use the `Kubefile` to define a cluster image that can be shared and deployed offline. a `Kubefile` just
     5  like `Dockerfile` which contains the build instructions to define the specific cluster.
     6  
     7  ## FROM instruction
     8  
     9  The `FROM` instruction defines which base image you want reference, and the first instruction in Kubefile must be the
    10  FROM instruction. Registry authentication information is required if the base image is a private image. By the way
    11  official base images are available from the Sealer community.
    12  
    13  > command format:FROM {your base image name}
    14  
    15  USAGE:
    16  
    17  For example ,use the base image `kubernetes:v1.19.8` which provided by the Sealer community to build a new cloud image.
    18  
    19  `FROM registry.cn-qingdao.aliyuncs.com/sealer-io/kubernetes:v1.19.8`
    20  
    21  ## COPY instruction
    22  
    23  The `COPY` instruction used to copy the contents from the context path such as file or directory to the `rootfs`. all
    24  the cloud image is based on the [rootfs](../../../../api/cloudrootfs.md), and the default src path is
    25  the `rootfs` .If the specified destination directory does not exist, sealer will create it automatically.
    26  
    27  > command format:COPY {src dest}
    28  
    29  USAGE:
    30  
    31  For example , copy `mysql.yaml`to`rootfs/mysql.yaml`
    32  
    33  `COPY mysql.yaml .`
    34  
    35  For example , copy directory `apollo` to `rootfs/charts/apollo`
    36  
    37  `COPY apollo charts`
    38  
    39  ## RUN instruction
    40  
    41  The RUN instruction will execute any commands in a new layer on top of the current image and commit the results. The
    42  resulting committed image will be used for the next step in the `Kubefile`.
    43  
    44  > command format:RUN {command args ...}
    45  
    46  USAGE:
    47  
    48  For example ,Using `RUN` instruction to execute a commands that download kubernetes dashboard.
    49  
    50  `RUN wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml`
    51  
    52  ### CMD instruction
    53  
    54  The format of CMD instruction is similar to RUN instruction, and also will execute any commands in a new layer. However,
    55  the CMD command will be executed when the cluster is started . it is generally used to start applications or configure
    56  the cluster. and it is different with `Dockerfile` CMD ,If you list more than one CMD in a `Kubefile` ,then all of them
    57  will take effect.
    58  
    59  > command format:CMD {command args ...}
    60  
    61  USAGE:
    62  
    63  For example ,Using `CMD` instruction to execute a commands that apply the kubernetes dashboard yaml.
    64  
    65  `CMD kubectl apply -f recommended.yaml`