Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/balena-io-modules/dockerfile-template
Process dockerfile templates, a format that allows replacing variables in Dockerfiles.
https://github.com/balena-io-modules/dockerfile-template
Last synced: 3 months ago
JSON representation
Process dockerfile templates, a format that allows replacing variables in Dockerfiles.
- Host: GitHub
- URL: https://github.com/balena-io-modules/dockerfile-template
- Owner: balena-io-modules
- License: apache-2.0
- Archived: true
- Created: 2015-09-23T14:29:41.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-07-01T14:30:05.000Z (over 2 years ago)
- Last Synced: 2024-04-15T17:53:48.437Z (7 months ago)
- Language: CoffeeScript
- Size: 25.4 KB
- Stars: 27
- Watchers: 13
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# dockerfile-template
**DEPRECATED -- This module has been deprecated; please use [balena-compose](https://github.com/balena-io-modules/balena-compose) instead.**
Process dockerfile templates, a format that allows replacing variables in dockerfiles.
### Installation
```bash
npm install dockerfile-template
```### Format
The format of a dockerfile template is the same as a Dockerfile, but augmented with variables.
Variables have the format %%VARIABLE_NAME%%, where variable name starts with an uppercase letter,
and can contain uppercase letters and underscores.Variables in comments (lines that start with #) are not processed.
### Library
This module exposes a single `process` method.
It receives a dockerfile template body and key-value pairs and replaces variables in the template.
If the template has variables that cannot be found, it throws an error.
Example:
```javascript
dockerfileTemplate = require("dockerfile-template");
variables = {
BASE: "debian",
TAG: "latest"
};
res = dockerfileTemplate.process("FROM %%BASE%%:%%TAG%%", variables);
console.log(res)
```Output:
```FROM debian:latest```
You can read the tests in `test` folder for more examples.
### Command line usage
The module also exposes a script for command line usage, to test templates.
After installing the module locally, the script should be in `./node_modules/.bin/dockerfile-template`.
```
Usage: dockerfile-template [options]Options:
-h, --help output usage information
-V, --version output the version number
-f, --filename template file to process (default: Dockerfile.template)
-d, --define [VARIABLE=value] replace variable with value (repeatable option)
```### Tests
Run the test suite by executing:
```sh
$ npm install
$ npm test
```### Contribute
- Issue Tracker: [github.com/resin-io/dockerfile-template/issues](https://github.com/resin-io/dockerfile-template/issues)
- Source Code: [github.com/resin-io/dockerfile-template](https://github.com/resin-io/dockerfile-template)Before submitting a PR, please make sure that you include tests, and that [coffeelint](http://www.coffeelint.org/) runs without any warning.
### License
The project is licensed under the Apache-2.0 License.