Dockerfiles API
Tier: Free, Premium, Ultimate
Offering: GitLab.com, Self-managed, GitLab Dedicated
GitLab은 인스턴스 수준의 Dockerfile 템플릿을 위한 API 엔드포인트를 제공합니다.
기본 템플릿은
vendor/Dockerfile
에서 정의되어 있습니다.
Guest 역할을 가진 사용자는 Dockerfile 템플릿에 접근할 수 없습니다.
자세한 내용은 프로젝트 및 그룹 가시성을 참조하세요.
Dockerfile API 템플릿 재정의
Tier: Premium, Ultimate
Offering: Self-managed, GitLab Dedicated
GitLab Premium 및 Ultimate 플랜에서
GitLab 인스턴스 관리자는
Admin 영역에서
템플릿을 재정의 할 수 있습니다.
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 |
string | 예 | Dockerfile 템플릿의 키 |
curl "https://gitlab.example.com/api/v4/templates/dockerfiles/Binary"
예시 응답:
{
"name": "Binary",
"content": "# 이 파일은 템플릿이며, 프로젝트에서 작동하기 전에 편집이 필요할 수 있습니다.\n# 이 Dockerfile은 컴파일된 바이너리를 빈 시스템에 설치합니다.\n# 컴파일된 바이너리를 소스 제어에 커밋하거나(권장하지 않음)\n# CI/CD 파이프라인의 일부분으로 바이너리를 먼저 빌드해야 합니다.\n\nFROM buildpack-deps:buster\n\nWORKDIR /usr/local/bin\n\n# `app`을 귀하의 바이너리 이름으로 변경하세요\nAdd app .\nCMD [\"./app\"]\n"
}