debian-mirror-gitlab/doc/api/templates/dockerfiles.md

114 lines
2 KiB
Markdown
Raw Normal View History

2018-12-05 23:21:45 +05:30
# Dockerfiles API
## List Dockerfile templates
Get all Dockerfile templates.
```
GET /templates/dockerfiles
```
```bash
curl https://gitlab.example.com/api/v4/templates/dockerfiles
```
Example response:
```json
[
{
"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": "OpenJDK-alpine",
"name": "OpenJDK-alpine"
},
{
"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"
}
]
```
## Single Dockerfile template
Get a single Dockerfile template.
```
GET /templates/dockerfiles/:key
```
| Attribute | Type | Required | Description |
| ---------- | ------ | -------- | ----------- |
| `key` | string | yes | The key of the Dockerfile template |
```bash
curl https://gitlab.example.com/api/v4/templates/dockerfiles/Binary
```
Example response:
```json
{
"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:jessie\n\nWORKDIR /usr/local/bin\n\n# Change `app` to whatever your binary is called\nAdd app .\nCMD [\"./app\"]\n"
}
```