Installing
There are many installation methods available for gomplate, depending on your platform and use-case.
macOS/Linux with homebrew
The simplest method for macOS and Linux is to use homebrew:
Using mise-en-place on Linux/MacOS/Windows
If you are using mise, the polyglot tool version manager, you can use a command like this:
macOS with MacPorts
On macOS, you can also install gomplate using MacPorts:
Windows with Chocolatey
The simplest method for installing gomplate on Windows is to use choco:
Alpine Linux
gomplate is available in Alpine’s community repository.
Note: the Alpine version of gomplate may lag behind the latest release of gomplate.
use with Docker
A simple way to get started is with one of the hairyhenderson/gomplate Docker images.
Of course, there are some drawbacks - any files to be used for [datasources][] must be mounted and any environment variables to be used must be passed through:
It can be awkward to always type docker run hairyhenderson/gomplate:stable,
so this can be made simpler with a shell alias:
use inside a container
gomplate is often used inside Docker containers. When building images with Docker 17.05 or higher, you can use multi-stage builds to easily include the gomplate binary in your container images.
Use the COPY instruction’s --from flag to accomplish this:
Now, gomplate will be available in the /bin directory inside the container image.
Note that when using gomplate with HTTPS-based datasources, you will likely need to install the ca-certificates package for your base distribution. Here’s an example when using the alpine base image:
manual install
- Get the latest
gomplatefor your platform from the releases page - Store the downloaded binary somewhere in your path as
gomplate(orgomplate.exeon Windows) - Make sure it’s executable (on Linux/macOS)
- Test it out with
gomplate --help!
In other words:
install with go install
If you’re a Go developer, sometimes it’s faster to just use go install to install gomplate:
(note that this method produces a binary that isn’t versioned and may not necessarily work correctly)
install with npm
For some users, especially Node.js developers, using npm may be a natural fit.
Even though gomplate is written in Go and not Node.js, it can still be installed
with npm:
install with tea.xyz
For some users (including for DEVOPS on GitHub Actions),
tea.xyz maybe be very comfortable, therefore, to install, just: