共用方式為


DockerCompose@0 - Docker Compose v0 工作

建置、推送或執行多容器 Docker 應用程式。 搭配 Docker 或 Azure Container Registry 使用此工作。

Syntax

# Docker Compose v0
# Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
- task: DockerCompose@0
  inputs:
    containerregistrytype: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required. Container Registry Type. Default: Azure Container Registry.
    #dockerRegistryEndpoint: # string. Optional. Use when containerregistrytype = Container Registry. Docker Registry Service Connection. 
    #azureSubscription: # string. Alias: azureSubscriptionEndpoint. Optional. Use when containerregistrytype = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when containerregistrytype = Azure Container Registry. Azure Container Registry. 
    dockerComposeFile: '**/docker-compose.yml' # string. Required. Docker Compose File. Default: **/docker-compose.yml.
    #additionalDockerComposeFiles: # string. Additional Docker Compose Files. 
    #dockerComposeFileArgs: # string. Environment Variables. 
    #projectName: '$(Build.Repository.Name)' # string. Project Name. Default: $(Build.Repository.Name).
    #qualifyImageNames: true # boolean. Qualify Image Names. Default: true.
    action: 'Run a Docker Compose command' # 'Build services' | 'Push services' | 'Run services' | 'Run a specific service' | 'Lock services' | 'Write service image digests' | 'Combine configuration' | 'Run a Docker Compose command'. Required. Action. Default: Run a Docker Compose command.
    #additionalImageTags: # string. Optional. Use when action = Build services || action = Push services. Additional Image Tags. 
    #includeSourceTags: false # boolean. Optional. Use when action = Build services || action = Push services. Include Source Tags. Default: false.
    #includeLatestTag: false # boolean. Optional. Use when action = Build services || action = Push services. Include Latest Tag. Default: false.
    #buildImages: true # boolean. Optional. Use when action = Run services. Build Images. Default: true.
    #serviceName: # string. Required when action = Run a specific service. Service Name. 
    #containerName: # string. Optional. Use when action = Run a specific service. Container Name. 
    #ports: # string. Optional. Use when action = Run a specific service. Ports. 
    #workingDirectory: # string. Alias: workDir. Optional. Use when action = Run a specific service. Working Directory. 
    #entrypoint: # string. Optional. Use when action = Run a specific service. Entry Point Override. 
    #containerCommand: # string. Optional. Use when action = Run a specific service. Command. 
    #detached: true # boolean. Optional. Use when action = Run services || action = Run a specific service. Run in Background. Default: true.
    #abortOnContainerExit: true # boolean. Optional. Use when action = Run services && detached == false. Abort on Container Exit. Default: true.
    #imageDigestComposeFile: '$(Build.StagingDirectory)/docker-compose.images.yml' # string. Required when action = Write service image digests. Image Digest Compose File. Default: $(Build.StagingDirectory)/docker-compose.images.yml.
    #removeBuildOptions: false # boolean. Optional. Use when action = Lock services || action = Combine configuration. Remove Build Options. Default: false.
    #baseResolveDirectory: # string. Optional. Use when action = Lock services || action = Combine configuration. Base Resolve Directory. 
    #outputDockerComposeFile: '$(Build.StagingDirectory)/docker-compose.yml' # string. Required when action = Lock services || action = Combine configuration. Output Docker Compose File. Default: $(Build.StagingDirectory)/docker-compose.yml.
    #dockerComposeCommand: # string. Required when action = Run a Docker Compose command. Command. 
    #arguments: # string. Optional. Use when action != Lock services && action != Combine configuration && action != Write service image digests. Arguments. 
  # Advanced Options
    #dockerHostEndpoint: # string. Docker Host Service Connection. 
    #nopIfNoDockerComposeFile: false # boolean. No-op if no Docker Compose File. Default: false.
    #requireAdditionalDockerComposeFiles: false # boolean. Require Additional Docker Compose Files. Default: false.
    #currentWorkingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd. Working Directory. Default: $(System.DefaultWorkingDirectory).
    #dockerComposePath: # string. Docker Compose executable Path.
# Docker Compose v0
# Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
- task: DockerCompose@0
  inputs:
    containerregistrytype: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required. Container Registry Type. Default: Azure Container Registry.
    #dockerRegistryEndpoint: # string. Optional. Use when containerregistrytype = Container Registry. Docker Registry Service Connection. 
    #azureSubscription: # string. Alias: azureSubscriptionEndpoint. Optional. Use when containerregistrytype = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when containerregistrytype = Azure Container Registry. Azure Container Registry. 
    dockerComposeFile: '**/docker-compose.yml' # string. Required. Docker Compose File. Default: **/docker-compose.yml.
    #additionalDockerComposeFiles: # string. Additional Docker Compose Files. 
    #dockerComposeFileArgs: # string. Environment Variables. 
    #projectName: '$(Build.Repository.Name)' # string. Project Name. Default: $(Build.Repository.Name).
    #qualifyImageNames: true # boolean. Qualify Image Names. Default: true.
    action: 'Run a Docker Compose command' # 'Build services' | 'Push services' | 'Run services' | 'Run a specific service' | 'Lock services' | 'Write service image digests' | 'Combine configuration' | 'Run a Docker Compose command'. Required. Action. Default: Run a Docker Compose command.
    #additionalImageTags: # string. Optional. Use when action = Build services || action = Push services. Additional Image Tags. 
    #includeSourceTags: false # boolean. Optional. Use when action = Build services || action = Push services. Include Source Tags. Default: false.
    #includeLatestTag: false # boolean. Optional. Use when action = Build services || action = Push services. Include Latest Tag. Default: false.
    #buildImages: true # boolean. Optional. Use when action = Run services. Build Images. Default: true.
    #serviceName: # string. Required when action = Run a specific service. Service Name. 
    #containerName: # string. Optional. Use when action = Run a specific service. Container Name. 
    #ports: # string. Optional. Use when action = Run a specific service. Ports. 
    #workingDirectory: # string. Alias: workDir. Optional. Use when action = Run a specific service. Working Directory. 
    #entrypoint: # string. Optional. Use when action = Run a specific service. Entry Point Override. 
    #containerCommand: # string. Optional. Use when action = Run a specific service. Command. 
    #detached: true # boolean. Optional. Use when action = Run services || action = Run a specific service. Run in Background. Default: true.
    #abortOnContainerExit: true # boolean. Optional. Use when action = Run services && detached == false. Abort on Container Exit. Default: true.
    #imageDigestComposeFile: '$(Build.StagingDirectory)/docker-compose.images.yml' # string. Required when action = Write service image digests. Image Digest Compose File. Default: $(Build.StagingDirectory)/docker-compose.images.yml.
    #removeBuildOptions: false # boolean. Optional. Use when action = Lock services || action = Combine configuration. Remove Build Options. Default: false.
    #baseResolveDirectory: # string. Optional. Use when action = Lock services || action = Combine configuration. Base Resolve Directory. 
    #outputDockerComposeFile: '$(Build.StagingDirectory)/docker-compose.yml' # string. Required when action = Lock services || action = Combine configuration. Output Docker Compose File. Default: $(Build.StagingDirectory)/docker-compose.yml.
    #dockerComposeCommand: # string. Required when action = Run a Docker Compose command. Command. 
    #arguments: # string. Optional. Use when action != Lock services && action != Combine configuration && action != Write service image digests. Arguments. 
  # Advanced Options
    #dockerHostEndpoint: # string. Docker Host Service Connection. 
    #nopIfNoDockerComposeFile: false # boolean. No-op if no Docker Compose File. Default: false.
    #requireAdditionalDockerComposeFiles: false # boolean. Require Additional Docker Compose Files. Default: false.
    #currentWorkingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd. Working Directory. Default: $(System.DefaultWorkingDirectory).
# Docker Compose v0
# Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
- task: DockerCompose@0
  inputs:
    containerregistrytype: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required. Container Registry Type. Default: Azure Container Registry.
    #dockerRegistryEndpoint: # string. Optional. Use when containerregistrytype = Container Registry. Docker Registry Service Connection. 
    #azureSubscription: # string. Alias: azureSubscriptionEndpoint. Optional. Use when containerregistrytype = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when containerregistrytype = Azure Container Registry. Azure Container Registry. 
    dockerComposeFile: '**/docker-compose.yml' # string. Required. Docker Compose File. Default: **/docker-compose.yml.
    #additionalDockerComposeFiles: # string. Additional Docker Compose Files. 
    #dockerComposeFileArgs: # string. Environment Variables. 
    #projectName: '$(Build.Repository.Name)' # string. Project Name. Default: $(Build.Repository.Name).
    #qualifyImageNames: true # boolean. Qualify Image Names. Default: true.
    action: 'Run a Docker Compose command' # 'Build services' | 'Push services' | 'Run services' | 'Run a specific service' | 'Lock services' | 'Write service image digests' | 'Combine configuration' | 'Run a Docker Compose command'. Required. Action. Default: Run a Docker Compose command.
    #additionalImageTags: # string. Optional. Use when action = Build services || action = Push services. Additional Image Tags. 
    #includeSourceTags: false # boolean. Optional. Use when action = Build services || action = Push services. Include Source Tags. Default: false.
    #includeLatestTag: false # boolean. Optional. Use when action = Build services || action = Push services. Include Latest Tag. Default: false.
    #buildImages: true # boolean. Optional. Use when action = Run services. Build Images. Default: true.
    #serviceName: # string. Required when action = Run a specific service. Service Name. 
    #containerName: # string. Optional. Use when action = Run a specific service. Container Name. 
    #ports: # string. Optional. Use when action = Run a specific service. Ports. 
    #workingDirectory: # string. Alias: workDir. Optional. Use when action = Run a specific service. Working Directory. 
    #entrypoint: # string. Optional. Use when action = Run a specific service. Entry Point Override. 
    #containerCommand: # string. Optional. Use when action = Run a specific service. Command. 
    #detached: true # boolean. Optional. Use when action = Run services || action = Run a specific service. Run in Background. Default: true.
    #abortOnContainerExit: true # boolean. Optional. Use when action = Run services && detached == false. Abort on Container Exit. Default: true.
    #imageDigestComposeFile: '$(Build.StagingDirectory)/docker-compose.images.yml' # string. Required when action = Write service image digests. Image Digest Compose File. Default: $(Build.StagingDirectory)/docker-compose.images.yml.
    #removeBuildOptions: false # boolean. Optional. Use when action = Lock services || action = Combine configuration. Remove Build Options. Default: false.
    #baseResolveDirectory: # string. Optional. Use when action = Lock services || action = Combine configuration. Base Resolve Directory. 
    #outputDockerComposeFile: '$(Build.StagingDirectory)/docker-compose.yml' # string. Required when action = Lock services || action = Combine configuration. Output Docker Compose File. Default: $(Build.StagingDirectory)/docker-compose.yml.
    #dockerComposeCommand: # string. Required when action = Run a Docker Compose command. Command. 
  # Advanced Options
    #dockerHostEndpoint: # string. Docker Host Service Connection. 
    #nopIfNoDockerComposeFile: false # boolean. No-op if no Docker Compose File. Default: false.
    #requireAdditionalDockerComposeFiles: false # boolean. Require Additional Docker Compose Files. Default: false.
    #currentWorkingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd. Working Directory. Default: $(System.DefaultWorkingDirectory).

輸入

containerregistrytype - Container Registry 類型
string. 必要。 允許值:Azure Container RegistryContainer Registry。 預設值:Azure Container Registry

使用 ACR 時,指定 Azure Container Registry 類型。 如果使用任何其他容器登錄,請指定 Container Registry 類型。


dockerRegistryEndpoint - Docker Registry 服務連線
string. 選擇性。 使用 時 containerregistrytype = Container Registry

指定 Docker 登錄服務連線。 當命令需要使用登錄進行驗證時需要。


azureSubscription - Azure 訂用帳戶
輸入別名: azureSubscriptionEndpointstring. 選擇性。 使用 時 containerregistrytype = Azure Container Registry

指定 Azure 訂用帳戶。 Azure 服務連線的名稱。 若要手動設定連線,請參閱 Azure Resource Manager 服務連線


azureContainerRegistry - Azure Container Registry
string. 選擇性。 使用 時 containerregistrytype = Azure Container Registry

指定 Azure Container Registry。


dockerComposeFile - Docker Compose 檔案
string. 必要。 預設值:**/docker-compose.yml

指定主要 Docker Compose 檔案的檔案路徑。


additionalDockerComposeFiles - 其他 Docker Compose 檔案
string.

指定與主要 Docker Compose 檔案結合的其他 Docker Compose 檔案。 相對路徑會解析為相對於包含主要 Docker Compose 檔案的目錄。 如果找不到指定的檔案,則會忽略它。 在新行上指定每個檔案路徑。


dockerComposeFileArgs - 環境變數
string.

指定所設定的任何環境變數。

格式如下:

  • 列出新行上的每 name=value 一組。
  • |使用 YAML 中的運算符來保留新行。

projectName - 專案名稱
string. 預設值:$(Build.Repository.Name)

指定預設用來命名映像和容器的項目名稱。


qualifyImageNames - 限定影像名稱
boolean. 預設值:true

根據預設,指定 Docker 登錄服務連線的主機名。


action - 行動
string. 必要。 允許的值: Build services (建置服務映像) 、 Push services (推送服務映像) 、 (執行服務映像) 、 (執行特定服務映射) 、 Lock servicesRun a specific serviceRun services (鎖定服務映射) 、、、 。 Combine configurationRun a Docker Compose commandWrite service image digests 預設值:Run a Docker Compose command

從允許的值清單中指定 Docker Compose 動作。


additionalImageTags - 其他影像標記
string. 選擇性。 使用 時 action = Build services || action = Push services

指定所建置或推送之 Docker 映像的其他標籤。 您可以指定多個標記,以換行字元 \n分隔每個標記。


includeSourceTags - 包含來源標籤
boolean. 選擇性。 使用 時 action = Build services || action = Push services。 預設值:false

指定建置或推送 Docker 映射時的 Git 標記。


includeLatestTag - 包含最新標籤
boolean. 選擇性。 使用 時 action = Build services || action = Push services。 預設值:false

指定建置或推送 Docker 映射時 的最新 標記。


buildImages - 組建映像
boolean. 選擇性。 使用 時 action = Run services。 預設值:true

指定啟動服務容器之前的組建映像。


serviceName - 服務名稱
string. 當 action = Run a specific service 時為必要。

指定您要執行的服務名稱。


containerName - 容器名稱
string. 選擇性。 使用 時 action = Run a specific service

指定您想要使用的服務容器名稱。


ports - 港口
string. 選擇性。 使用 時 action = Run a specific service

指定要發佈至主機的服務容器中的埠。 在新行上新增每個 host-port:container-port 系結。


workingDirectory - 工作目錄
輸入別名: workDirstring. 選擇性。 使用 時 action = Run a specific service

指定服務容器的工作目錄。


entrypoint - 進入點覆寫
string. 選擇性。 使用 時 action = Run a specific service

指定服務容器預設進入點的覆寫值。


containerCommand - 命令
string. 選擇性。 使用 時 action = Run a specific service

指定要在服務容器中執行的命令。 例如,如果映像包含簡單的 Python Flask Web 應用程式,您可以指定 python app.py 來啟動 Web 應用程式。


detached - 在背景中執行
boolean. 選擇性。 使用時機 action = Run services || action = Run a specific service。 預設值:true

指定要在背景中執行的服務容器。


abortOnContainerExit - 在容器結束時中止
boolean. 選擇性。 使用時機 action = Run services && detached == false。 預設值:true

指定當任何容器結束時應該停止的所有容器。


imageDigestComposeFile - 影像摘要撰寫檔案
string. 當 action = Write service image digests 時為必要。 預設值:$(Build.StagingDirectory)/docker-compose.images.yml

指定 Docker Compose 檔案的路徑,該檔案會建立並填入每個服務 Docker 映像的完整映射存放庫摘要。


removeBuildOptions - 拿掉建置選項
boolean. 選擇性。 使用時機 action = Lock services || action = Combine configuration。 預設值:false

指定是否應該從輸出 Docker Compose 檔案中移除組建選項。


baseResolveDirectory - 基底解析目錄
string. 選擇性。 使用時機 action = Lock services || action = Combine configuration

指定應該解析輸出 Docker Compose 檔案中相對路徑的基底目錄。


outputDockerComposeFile - 輸出 Docker Compose 檔案
string. 當 action = Lock services || action = Combine configuration 時為必要。 預設值:$(Build.StagingDirectory)/docker-compose.yml

指定輸出 Docker Compose 檔案的路徑。


dockerComposeCommand - 命令
string. 當 action = Run a Docker Compose command 時為必要。

指定要搭配自變數執行的 Docker Compose 命令。 例如, rm --all 若要移除所有已停止的服務容器。


arguments - 參數
string. 選擇性。 使用時機 action != Lock services && action != Combine configuration && action != Write service image digests

指定 Docker Compose 命令選項。

範例:針對建置命令, --pull --compress --parallel


dockerHostEndpoint - Docker 主機服務連線
string.

指定 Docker 主機服務連線。 預設為代理程式的主機。


nopIfNoDockerComposeFile - 如果沒有 Docker Compose 檔案,則為 No-op
boolean. 預設值:false

指定值,如果 Docker Compose 檔案不存在,則會略過工作。 當工作根據存放庫中的 Docker Compose 檔案存在,提供選擇性行為時,此選項會很有用。


requireAdditionalDockerComposeFiles - 需要其他 Docker Compose 檔案
boolean. 預設值:false

指定值,如果其他 Docker Compose 檔案不存在,就會產生錯誤。 此選項會覆寫預設行為,如果檔案不存在,則會忽略該檔案。


currentWorkingDirectory - 工作目錄
輸入別名: cwdstring. 預設值:$(System.DefaultWorkingDirectory)

指定 Docker Compose 命令的工作目錄。


dockerComposePath - Docker Compose 可執行文件路徑
string.

指定路徑,以判斷是否使用docker-compose可執行檔。


工作控制選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控件選項和一般工作屬性

輸出變數

此工作會定義下列 輸出變數,您可以在下游步驟、作業和階段中取用這些變數。

DockerComposeOutput
包含命令輸出的檔案路徑。 這可以包含多個檔案路徑 (以換行符分隔) ,例如 dockerComposeRun 命令 (一個用於執行,另一個用於向下) 、dockerPush (每個推送) 的映射、dockerBuild (組建本身,以及每個提取) 映射) 的 dockerDigest (一個。 其他命令只會輸出一個檔案。

無。

備註

使用此工作來建置、推送或執行多容器 Docker 應用程式。 搭配 Docker 登錄或 Azure Container Registry 使用此工作。

範例

Azure Container Registry

此 YAML 範例會指定 Azure Container Registry 的輸入:

variables:
  azureContainerRegistry: Contoso.azurecr.io
  azureSubscriptionEndpoint: Contoso
steps:
- task: DockerCompose@0
  displayName: Container registry login
  inputs:
    containerregistrytype: Azure Container Registry
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)

其他容器登錄

使用 ACR 以外的任何容器登錄時,需要 containerregistrytype 值。 在這裡情況下,請使用 containerregistrytype: Container Registry

此 YAML 範例會指定 ACR 以外的容器登錄,其中 Contoso 是容器登錄的 Docker 登錄服務連線名稱:

- task: DockerCompose@0
  displayName: Container registry login
  inputs:
    containerregistrytype: Container Registry
    dockerRegistryEndpoint: Contoso

建置服務映像

此 YAML 範例會根據與 Azure Container Registry 相關的輸入來建置映射名稱,

- task: DockerCompose@0
  displayName: Build services
  inputs:
    action: Build services
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    dockerComposeFile: docker-compose.yml
    projectName: $(Build.Repository.Name)
    qualifyImageNames: true
    additionalImageTags: $(Build.BuildId)
    dockerComposeFileArgs: |
      firstArg=$(firstArg)
      secondArg=$(secondArg)

推送服務映像

此 YAML 範例會將映像推送至容器登錄:

- task: DockerCompose@0
  displayName: Push services
  inputs:
    action: Push services
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    dockerComposeFile: docker-compose.yml
    projectName: $(Build.Repository.Name)
    qualifyImageNames: true
    additionalImageTags: $(Build.BuildId)

執行服務映像

此 YAML 範例會執行服務:

- task: DockerCompose@0
  displayName: Run services
  inputs:
    action: Run services
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    dockerComposeFile: docker-compose.ci.build.yml
    projectName: $(Build.Repository.Name)
    qualifyImageNames: true
    buildImages: true
    abortOnContainerExit: true
    detached: true

執行特定服務映像

此 YAML 範例會執行特定服務:

- task: DockerCompose@0
  displayName: Run a specific service
  inputs:
    action: Run a specific service
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    dockerComposeFile: docker-compose.yml
    projectName: $(Build.Repository.Name)
    qualifyImageNames: true
    serviceName: myhealth.web
    ports: 80:80
    detached: true

鎖定服務映像

此 YAML 範例會鎖定服務:

- task: DockerCompose@0
  displayName: Lock services
  inputs:
    action: Lock services
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    dockerComposeFile: docker-compose.yml
    projectName: $(Build.Repository.Name)
    qualifyImageNames: true
    outputDockerComposeFile: $(Build.StagingDirectory)/docker-compose.yml

寫入服務映像摘要

此 YAML 範例會寫入服務映像摘要:

- task: DockerCompose@0
  displayName: Write service image digests
  inputs:
    action: Write service image digests
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    dockerComposeFile: docker-compose.yml
    projectName: $(Build.Repository.Name)
    qualifyImageNames: true
    imageDigestComposeFile: $(Build.StagingDirectory)/docker-compose.images.yml 

合併組態

此 YAML 範例結合了組態:

- task: DockerCompose@0
  displayName: Combine configuration
  inputs:
    action: Combine configuration
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    dockerComposeFile: docker-compose.yml
    additionalDockerComposeFiles: docker-compose.override.yml
    projectName: $(Build.Repository.Name)
    qualifyImageNames: true
    outputDockerComposeFile: $(Build.StagingDirectory)/docker-compose.yml

執行 Docker Compose 命令

此 YAML 範例會執行 docker Compose 命令:

- task: DockerCompose@0
  displayName: Run a Docker Compose command
  inputs:
    action: Run a Docker Compose command
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    dockerComposeFile: docker-compose.yml 
    projectName: $(Build.Repository.Name)
    qualifyImageNames: true
    dockerComposeCommand: rm

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
在上執行 Agent、DeploymentGroup
要求
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任何
可設定變數 任何
代理程式版本 所有支援的代理程式版本。
工作類別 建置