Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d434f7933 |
||
|
|
9904e2eaec |
5 changed files with 22 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
FROM registry.fedoraproject.org/f27/s2i-base:latest
|
||||
FROM registry.fedoraproject.org/f30/s2i-base:latest
|
||||
|
||||
ENV NAME=golang \
|
||||
VERSION=1.9 \
|
||||
VERSION=1.11 \
|
||||
ARCH=x86_64
|
||||
|
||||
ENV SUMMARY="Platform for building and running Go $VERSION based applications" \
|
||||
|
|
|
|||
|
|
@ -20,11 +20,14 @@ if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then
|
|||
|
||||
mv /tmp/src/* $GOPATH/src/$IMPORT_URL
|
||||
|
||||
if [[ -d /tmp/artifacts/pkg ]]; then
|
||||
if [[ -d /tmp/artifacts/pkg || -d /tmp/artifacts/go-build ]]; then
|
||||
|
||||
echo "Restoring previous build artifacts"
|
||||
|
||||
mv /tmp/artifacts/pkg $GOPATH
|
||||
GOCACHE=`go env GOCACHE`
|
||||
mkdir -p $GOCACHE
|
||||
mv /tmp/artifacts/go-build $GOCACHE
|
||||
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,24 @@
|
|||
|
||||
set -e
|
||||
|
||||
TOSAVE=""
|
||||
|
||||
if [[ -d $HOME/go/pkg ]]; then
|
||||
|
||||
pushd $HOME/go &> /dev/null
|
||||
|
||||
tar -cf - pkg
|
||||
|
||||
popd &> /dev/null
|
||||
mv $HOME/go/pkg pkg &> /dev/null
|
||||
TOSAVE=$TOSAVE"./pkg "
|
||||
|
||||
fi
|
||||
|
||||
if [[ -d `go env GOCACHE` ]]; then
|
||||
|
||||
mv `go env GOCACHE` go-build &> /dev/null
|
||||
TOSAVE=$TOSAVE"./go-build "
|
||||
|
||||
fi
|
||||
|
||||
if [[ -n "$TOSAVE" ]]; then
|
||||
|
||||
tar -cf - $TOSAVE
|
||||
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ NAMESPACE=centos
|
|||
[[ $DISTRO =~ rhel* ]] && NAMESPACE=rhscl
|
||||
|
||||
cat <<EOF
|
||||
This is a S2I golang-1.9 ${DISTRO} base image:
|
||||
This is a S2I golang-1.11 ${DISTRO} base image:
|
||||
To use it, install S2I: https://github.com/openshift/source-to-image
|
||||
Sample invocation:
|
||||
s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' git://github.com/cpuguy83/go-md2man ${NAMESPACE}/golang-1.9-${DISTRO} go-sample-app
|
||||
s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' git://github.com/cpuguy83/go-md2man ${NAMESPACE}/golang-1.11-${DISTRO} go-sample-app
|
||||
You can then run the resulting image via:
|
||||
docker run go-sample-app
|
||||
EOF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue