Dockerfiles API

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

GitLab은 인스턴스 수준의 Dockerfile 템플릿을 위한 API 엔드포인트를 제공합니다. 기본 템플릿은 GitLab 리포지토리의 vendor/Dockerfile에 정의됩니다.

Dockerfile API 템플릿 재정의

Tier: Premium, Ultimate Offering: 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 string yes 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"
}