Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bamarni/dockplate
Templating for Dockerfiles.
https://github.com/bamarni/dockplate
docker dockerfile template templating
Last synced: about 1 month ago
JSON representation
Templating for Dockerfiles.
- Host: GitHub
- URL: https://github.com/bamarni/dockplate
- Owner: bamarni
- Created: 2016-04-06T07:11:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-06T07:18:36.000Z (over 8 years ago)
- Last Synced: 2024-08-17T08:04:55.740Z (4 months ago)
- Topics: docker, dockerfile, template, templating
- Language: Go
- Homepage:
- Size: 1000 Bytes
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dockplate
Templating for Dockerfiles.
## Why?
It is common for Dockerfiles to share a similar base with slight modifications.
It happens when applying the same changes from different base images, or tuning images for production / development.For those cases it might be useful to have a simple template which can be used
to generate different "flavours" of the same Dockerfile.## Installation
### Prebuilt binaries
Prebuilt binaries are available in the [releases](https://github.com/bamarni/dockplate/releases).
### From source (requires Go)
go get github.com/bamarni/dockplate
## Usage
```
# ./Dockerfile.template
FROM debian:{{.Env.BASE_TAG}}# Common steps
# ...{{if eq .Env.ENVIRONMENT "prod"}}
# Production tweaks
# ...
{{else if eq .Env.ENVIRONMENT "dev"}}
# Development tweaks
# ...
{{end}}RUN ...
CMD ...
```*The template parser is based on golang's `text/template`,
cf. https://golang.org/pkg/text/template/ for full reference.*You can then generate Dockerfiles like this :
BASE_TAG=jessie ENVIRONMENT=prod dockplate < Dockerfile.template > jessie-prod/Dockerfile