Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
golang-s2i/s2i/bin/assemble
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
38 lines (30 sloc)
1.03 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -e | |
| # | |
| # S2I assemble script for the 'golang-builder' image. | |
| # The 'assemble' script builds your application source so that it is ready to run. | |
| # | |
| # For more information refer to the documentation: | |
| # https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md | |
| # | |
| set -o errexit | |
| # If the 'golang-builder' assemble script is executed with the '-h' flag, print the usage. | |
| if [[ "$1" == "-h" ]]; then | |
| exec /usr/libexec/s2i/usage | |
| fi | |
| # Restore artifacts from the previous build (if they exist). | |
| # | |
| if [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then | |
| echo "---> Restoring build artifacts..." | |
| mv /tmp/artifacts/. ./ | |
| fi | |
| echo "---> Installing application source..." | |
| cp -Rf /tmp/src/. ./ | |
| echo "---> Downloading dependencies..." | |
| go get -v | |
| # The -o app is important, as we have set this in the | |
| # s2i/bin/run script, allowing it to run whatever app was | |
| # generated by the build below | |
| echo "---> Building application from source..." | |
| go build -v -o app -a -installsuffix cgo | |
| echo "---> Running tests..." | |
| go test -v -o app_test.go | |