SLE BCI Go 1.21-openssl development

Go 1.21-openssl development container based on the SLE Base Container Image.

Get Image
Digest:
sha256:a92e2eedca6e3abed7153cc50db020c3ee7e71043844e78d1871e9cd25b17df2
a92e2eedc
Repository:
registry.suse.com/bci/golang:1.21-openssl

Go 1.21-openssl development Container Image

Redistributable SLSA Provenance: Available

Description

Go (a.k.a., Golang) is a statically-typed programming language, with syntax loosely derived from C. Go offers additional features such as garbage collection, type safety, certain dynamic-typing capabilities, additional built-in types (for example, variable-length arrays and key-value maps) as well as a large standard library.

Usage

To compile and deploy an application, copy the sources, fetch dependencies (assuming go.mod is used for dependency management), and build the binary:

# Build the application using the Go 1.21-openssl development Container Image
FROM registry.suse.com/bci/golang:1.21-openssl as build

WORKDIR /app

# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . ./

# Make sure to build the application with CGO disabled.
# This will force Go to use some Go implementations of code
# rather than those normally supplied by the host operating system.
# You need this for scratch images as those supporting libraries
# are not available.
RUN CGO_ENABLED=0 go build -o /hello

# Bundle the application into a scratch image
FROM scratch

COPY --from=build /hello /hello

CMD ["/hello"]

Build and run the container image:

$ podman build -t my-golang-app .
$ podman run -it --rm my-golang-app

There are situations when you don't want to run an application inside a container.

To compile the application, without running it inside a container instance, use the following command:

$ podman run --rm -v "$PWD":/app:Z -w /app registry.suse.com/bci/golang:1.21-openssl go build -v

To run the application tests inside a container, use the following command:

$ podman run --rm -v "$PWD":/app:Z -w /app registry.suse.com/bci/golang:1.21-openssl go test -v

Note: The Golang image should be used as a build environment. For runtime, self-contained Go binaries should use a scratch image and for applications that require external dependencies use the bci-base image.

Additional tools

The following additional tools are included in the image:

  • go1.21-openssl-race
  • make
  • git-core

FIPS 140

The image includes a FIPS 140 enabled Go toolchain using OpenSSL.

To restrict all TLS configuration to FIPS-approved settings, add the following line:

import _ "crypto/tls/fipsonly"

Licensing

SPDX-License-Identifier: MIT

This documentation and the build recipe are licensed as MIT. The container itself contains various software components under various open source licenses listed in the associated Software Bill of Materials (SBOM).

This image is based on SLE BCI, a stable and redistributable foundation for software innovation. SLE BCI is enterprise-ready, and it comes with an option for support.

See the SLE BCI EULA for further information.

  • Image Data

    Last Built: 13 Jun 15:51 UTC

    Size: 175.6 MB

    Support Level: L3


  • Health Index
    A

    No vulnerabilities found

    Last Scan:

    about 20 hours ago