All Projects → paketo-buildpacks → go-build

paketo-buildpacks / go-build

Licence: Apache-2.0 license
A Cloud Native Buildpack for compiling Go applications

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Labels

Projects that are alternatives of or similar to go-build

nodejs
A Cloud Native Buildpack for Node.JS
Stars: ✭ 29 (+61.11%)
Mutual labels:  cnb
dotnet-core
A Cloud Native Buildpack for .NET Core
Stars: ✭ 27 (+50%)
Mutual labels:  cnb
java
A Cloud Native Buildpack with an order definition suitable for Java applications
Stars: ✭ 66 (+266.67%)
Mutual labels:  cnb
go-dist
A Cloud Native Buildpack for Go
Stars: ✭ 17 (-5.56%)
Mutual labels:  cnb
graalvm
A Cloud Native Buildpack that provides the GraalVM implementations of JREs and JDKs
Stars: ✭ 21 (+16.67%)
Mutual labels:  cnb
go
A Cloud Native Buildpack for Go
Stars: ✭ 53 (+194.44%)
Mutual labels:  cnb
ruby
No description or website provided.
Stars: ✭ 15 (-16.67%)
Mutual labels:  cnb
bellsoft-liberica
A Cloud Native Buildpack that provides the Bellsoft Liberica implementations of JREs and JDKs
Stars: ✭ 33 (+83.33%)
Mutual labels:  cnb
php
A Cloud Native Buildpack for PHP
Stars: ✭ 17 (-5.56%)
Mutual labels:  cnb

Go Build Cloud Native Buildpack

The Go Build CNB executes the go build compilation process for Go programs. The buildpack builds the source code in the application directory into an executable and sets it as the start command for the image.

Integration

The Go Build CNB does not provide any dependencies. However, in order to execute the go build compilation process, the buildpack requires the go dependency that can be provided by a buildpack like the Go Distribution CNB.

Usage

To package this buildpack for consumption:

$ ./scripts/package.sh

This builds the buildpack's Go source using GOOS=linux by default. You can supply another value as the first argument to package.sh.

Go Build Configuration

Please set the following environment variables at build time either directly (ex. pack build my-app --env BP_ENVIRONMENT_VARIABLE=some-value) or through a project.toml file

BP_GO_BUILD_LDFLAGS

The BP_GO_BUILD_LDFLAGS variable allows you to set a value for the -ldflags build flag when compiling your program.

BP_GO_BUILD_LDFLAGS= -X main.variable=some-value

BP_GO_TARGETS

The BP_GO_TARGETS variable allows you to specify multiple programs to be compiled. The first target will be used as the start command for the image.

BP_GO_TARGETS=./cmd/web-server:./cmd/debug-server

BP_GO_BUILD_FLAGS

The BP_GO_BUILD_FLAGS variable allows you to override the default build flags when compiling your program.

BP_GO_BUILD_FLAGS= -buildmode=default -tags=paketo -ldflags="-X main.variable=some-value"

BP_GO_BUILD_IMPORT_PATH

The BP_GO_BUILD_IMPORT_PATH allows you to specify an import path for your application. This is necessary if you are building a $GOPATH application that imports its own sub-packages.

BP_GO_BUILD_IMPORT_PATH= example.com/some-app

BP_KEEP_FILES

The BP_KEEP_FILES variable allows to you to specity a path list of files (including file globs) that you would like to appear in the workspace of the final image. This will allow you to perserve static assests.

BP_KEEP_FILES=assets/*:public/*

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].