Skip to content

Installation

Package Managers

This section describes the installation of gotmpl in a native environment.

Tip

If you want to install it in a Dockerfile follow our Docker instructions to create minimal images.

apk (Alpine)

apk

curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.alpine.sh' | sudo -E bash
sudo apk add gotmpl
curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.alpine.sh' | sudo -E bash
sudo apk add gotmpl==0.0.0

deb (Debian/Ubuntu)

apt

curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.deb.sh' | sudo -E bash
sudo apt-get install gotmpl
curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.deb.sh' | sudo -E bash
sudo apt-get install gotmpl==0.0.0

rpm (RHEL/CentOS/Fedora)

dnf

curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.rpm.sh' | sudo -E bash
sudo dnf install gotmpl
curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.rpm.sh' | sudo -E bash
sudo dnf install gotmpl==0.0.0

yum

curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.rpm.sh' | sudo -E bash
sudo yum install gotmpl
curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.rpm.sh' | sudo -E bash
sudo yum install gotmpl==0.0.0

Docker

If you want to install this tool to use it in a container follow these instructions to achieve minimal images.

Warning

Compact is preferred since it creates only one layer, Detailed is only for explanation.

Tip

For building images we recommend pinning versions to have stable results.

apk

ARG GOTMPL_VERSION=0.0.0

RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.apk.sh' | bash && \
    apk add --no-cache gotmpl==$GOTMPL_VERSION
# Set to install fixed fixed specific version
ARG GOTMPL_VERSION=0.0.0

# Install dependencies (optional - your base image might already contain them)
RUN apk add --no-cache curl bash

# Setup our package repository
RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.deb.sh' | bash

# Install gotmpl
RUN apk add --no-cache gotmpl==$GOTMPL_VERSION

apt

ARG GOTMPL_VERSION=0.0.0

RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.deb.sh' | bash && \
    apt-get update && \
    apt-get install -y --no-install-recommends gotmpl==$GOTMPL_VERSION && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*
# Set to install fixed fixed specific version
ARG GOTMPL_VERSION=0.0.0

# Install dependencies (optional - your base image might already contain them)
RUN apt-get update && \
    apt-get install -y --no-install-recommends curl bash && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Setup our package repository
RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl-test/setup.deb.sh' | bash

# Install gotmpl
RUN apt-get update && \
    apt-get install -y --no-install-recommends gotmpl==$GOTMPL_VERSION
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

dnf

ARG GOTMPL_VERSION=0.0.0

RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.rpm.sh' | bash && \
    dnf install -y --setopt=install_weak_deps=false gotmpl==$GOTMPL_VERSION && \
    dnf clean all && \
    rm -rf /var/cache/yum
# Set to install fixed specific version
ARG GOTMPL_VERSION=0.0.0

# Install dependencies (optional - your base image might already contain them)
RUN dnf install -y --setopt=install_weak_deps=false curl bash && \
    dnf clean all && \
    rm -rf /var/cache/yum

# Setup our package repository
RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl-test/setup.rpm.sh' | bash

# Install gotmpl
RUN dnf install -y --setopt=install_weak_deps=false gotmpl==$GOTMPL_VERSION && \
    dnf clean all && \
    rm -rf /var/cache/yum

microdnf

ARG GOTMPL_VERSION=0.0.0

RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.rpm.sh' | bash && \
    microdnf install -y --setopt=install_weak_deps=false gotmpl==$GOTMPL_VERSION && \
    microdnf clean all && \
    rm -rf /var/cache/yum
# Set to install fixed specific version
ARG GOTMPL_VERSION=0.0.0

# Install dependencies (optional - your base image might already contain them)
RUN microdnf install -y --setopt=install_weak_deps=false curl bash && \
    microdnf clean all && \
    rm -rf /var/cache/yum

# Setup our package repository
RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl-test/setup.rpm.sh' | bash

# Install gotmpl
RUN microdnf install -y --setopt=install_weak_deps=false gotmpl==$GOTMPL_VERSION && \
    microdnf clean all && \
    rm -rf /var/cache/yum

yum

ARG GOTMPL_VERSION=0.0.0

RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl/setup.rpm.sh' | bash && \
    yum install -y --setopt=tsflags=nodocs gotmpl==$GOTMPL_VERSION && \
    yum clean all && \
    rm -rf /var/cache/yum
# Set to install fixed specific version
ARG GOTMPL_VERSION=0.0.0

# Install dependencies (optional - your base image might already contain them)
RUN yum install -y --setopt=tsflags=nodocs curl bash && \
    yum clean all && \
    rm -rf /var/cache/yum

# Setup our package repository
RUN curl -1sLf 'https://dl.cloudsmith.io/basic/gotmpl/gotmpl-test/setup.rpm.sh' | bash

# Install gotmpl
RUN yum install -y --setopt=tsflags=nodocs gotmpl==$GOTMPL_VERSION && \
    yum clean all && \
    rm -rf /var/cache/yum

GitHub

We release our packages via GitHub Releases and you can install them by downloading (and validating) them directly from there.

Note

This is only recommended if your operating system does not support the package managers above.

Linux:

VERSION=0.0.0 ARCH=amd64; wget -O - https://github.com/gotmpl/gotmpl/releases/download/$VERSION/gotmpl-$VERSION-linux-$ARCH.tar.gz | tar xzf - -C /usr/local/bin

Linux (alpine):

VERSION=0.0.0 ARCH=amd64; wget -O - https://github.com/gotmpl/gotmpl/releases/download/$VERSION/gotmpl-$VERSION-linux-$ARCH-musl.tar.gz | tar xzf - -C /usr/local/bin

Go

The tool can also be installed via go CLI.

Warning

This is not recommended and should typically be used for development purposes only.

Tip

To build the CLI tool with Go, make sure you have Go installed (version 1.25 or newer recommended).

go install github.com/gotmpl/gotmpl@latest
go install github.com/gotmpl/gotmpl@v0.0.0

Build from Source

The tool can also be installed by building it directly from source.

Tip

To build the CLI tool from source, make sure you have Go installed (version 1.25 or newer recommended).

  1. Clone the repository:

    git clone https://github.com/gotmpl/gotmpl.git
    cd gotmpl
    
  2. Build the binary:

    go build -ldflags "-w -s"
    
  3. (Optional) Move the binary to a directory in your PATH:

    sudo mv gotmpl /usr/local/bin/