Dockerfile API
- プラン: Free、Premium、Ultimate
- 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated
GitLabは、インスタンス全体で利用可能なDockerfileテンプレート用のAPIエンドポイントを提供します。デフォルトテンプレートは、GitLab Gitリポジトリ内のvendor/Dockerfileで定義されています。
ゲストロールのユーザーは、Dockerfileテンプレートにアクセスできません。詳細については、プロジェクトとグループの表示レベルを参照してください。
Dockerfile APIテンプレートを上書きする
- プラン: Premium、Ultimate
- 提供形態: GitLab Self-Managed、GitLab Dedicated
GitLab PremiumおよびUltimateティアでは、GitLabインスタンス管理者は管理者エリアでテンプレートを上書きできます。
すべてのDockerfileテンプレートを一覧表示する
すべてのDockerfileテンプレートを一覧表示します。
GET /templates/dockerfilesリクエスト例:
curl "https://gitlab.example.com/api/v4/templates/dockerfiles"レスポンス例:
[
{
"key": "Binary",
"name": "Binary"
},
{
"key": "Binary-alpine",
"name": "Binary-alpine"
},
{
"key": "Binary-scratch",
"name": "Binary-scratch"
},
{
"key": "Golang",
"name": "Golang"
},
{
"key": "Golang-alpine",
"name": "Golang-alpine"
},
{
"key": "Golang-scratch",
"name": "Golang-scratch"
},
{
"key": "HTTPd",
"name": "HTTPd"
},
{
"key": "Node",
"name": "Node"
},
{
"key": "Node-alpine",
"name": "Node-alpine"
},
{
"key": "OpenJDK",
"name": "OpenJDK"
},
{
"key": "PHP",
"name": "PHP"
},
{
"key": "Python",
"name": "Python"
},
{
"key": "Python-alpine",
"name": "Python-alpine"
},
{
"key": "Python2",
"name": "Python2"
},
{
"key": "Ruby",
"name": "Ruby"
},
{
"key": "Ruby-alpine",
"name": "Ruby-alpine"
},
{
"key": "Rust",
"name": "Rust"
},
{
"key": "Swift",
"name": "Swift"
}
]単一のDockerfileテンプレートを取得する
単一のDockerfileテンプレートを取得します。
GET /templates/dockerfiles/:key| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
key | 文字列 | はい | Dockerfileテンプレートのキー |
リクエスト例:
curl "https://gitlab.example.com/api/v4/templates/dockerfiles/Binary"レスポンス例:
{
"name": "Binary",
"content": "# This file is a template, and might need editing before it works on your project.\n# This Dockerfile installs a compiled binary into a bare system.\n# You must either commit your compiled binary into source control (not recommended)\n# or build the binary first as part of a CI/CD pipeline.\n\nFROM buildpack-deps:buster\n\nWORKDIR /usr/local/bin\n\n# Change `app` to whatever your binary is called\nAdd app .\nCMD [\"./app\"]\n"
}