Chapter 5. Container images with Go Toolset

Go Toolset is available as container images for RHEL 7 and RHEL 8. They can be downloaded from the Red Hat Container Registry.

5.1. Images contents

The RHEL 7 and RHEL 8 container images provide content corresponding to the following packages:

ComponentVersionPackage

Go

1.12

go-toolset-1.12.z

5.2. Accessing the images

To pull the required image, run the following command as root:

  • For the RHEL 7 container images:
# podman pull registry.redhat.io/devtools/go-toolset-rhel7
# podman pull registry.redhat.io/ubi7/go-toolset
Note

Two RHEL 7 container images provide the same content.

  • For the RHEL 8 container images:
# podman pull registry.redhat.io/rhel8/go-toolset
# podman pull registry.redhat.io/ubi8/go-toolset
Note

Two RHEL 8 container images provide the same content.

5.3. Using as builder images with Source-to-Image

The Go toolset container image is prepared for use as a Source-to-Image (S2I) builder image.

To do so, set the following build environment variables:

IMPORT_URL
Set this variable to a URL specifying the location of the code. The rules for the go get command option apply.
INSTALL_URL

Set this variable to a URL specifying the location of the package that will provide the application’s main executable file when built. The rules for the go install command option apply.

This variable can be omitted if the main package location is identical with the location specified by the IMPORT_URL variable.

Example 5.1. Building a Go application image using Source-to-Image

To build the md2man package from its GitHub repository:

$ s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' -e INSTALL_URL='github.com/cpuguy83/go-md2man' git://github.com/cpuguy83/go-md2man  registry.access.redhat.com/devtools/go-toolset-rhel7
md2man-app

A locally available application image md2man-app is built from the repository on GitHub using the go-toolset container image.

To fully leverage the Go as a S2I builder image, build custom images based on it, with modified S2I assemble scripts and further modifications to accomodate the particular application being built.

A detailed description of the Go usage with Source-to-Image is beyond the scope of this document. For more information about Source-to-Image, see:

5.4. Additional Resources