mirror of
https://github.com/status-im/xgo.git
synced 2025-01-11 11:25:44 +00:00
Add support for Go develop containers
This commit is contained in:
parent
9cb9b4d00b
commit
fc7174aa2a
@ -92,8 +92,9 @@ be retrieved and installed.
|
||||
|
||||
Additionally, a few wildcard release strings are also supported:
|
||||
|
||||
- `latest` will use the latest Go release
|
||||
- `1.5.x` will use the latest point release of a specific Go version
|
||||
- `latest` will use the latest Go release (this is the default)
|
||||
- `develop` will use the master branch of the Go repository
|
||||
|
||||
### Output prefixing
|
||||
|
||||
|
@ -68,11 +68,16 @@ ADD bootstrap.sh /bootstrap.sh
|
||||
ENV BOOTSTRAP /bootstrap.sh
|
||||
RUN chmod +x $BOOTSTRAP
|
||||
|
||||
# Inject the new Go root distribution downloader and secondary bootstrapper
|
||||
# Inject the new Go root distribution downloader and bootstrapper
|
||||
ADD bootstrap_pure.sh /bootstrap_pure.sh
|
||||
ENV BOOTSTRAP_PURE /bootstrap_pure.sh
|
||||
RUN chmod +x $BOOTSTRAP_PURE
|
||||
|
||||
# Inject the Go source distribution downloader and bootstrapper
|
||||
ADD bootstrap_repo.sh /bootstrap_repo.sh
|
||||
ENV BOOTSTRAP_REPO /bootstrap_repo.sh
|
||||
RUN chmod +x $BOOTSTRAP_REPO
|
||||
|
||||
# Inject the C dependency cross compiler
|
||||
ADD build_deps.sh /build_deps.sh
|
||||
ENV BUILD_DEPS /build_deps.sh
|
||||
|
@ -4,21 +4,26 @@
|
||||
# not only a few pre-built Go cross compilers, but rather bootstraps all of the
|
||||
# supported platforms from the origin Linux amd64 distribution.
|
||||
#
|
||||
# Usage: bootstrap.sh
|
||||
# Usage: bootstrap_pure.sh
|
||||
#
|
||||
# Needed environment variables:
|
||||
# Environment variables for remote bootstrapping:
|
||||
# FETCH - Remote file fetcher and checksum verifier (injected by image)
|
||||
# ROOT_DIST - 64 bit Linux Go binary distribution package
|
||||
# ROOT_DIST_SHA1 - 64 bit Linux Go distribution package checksum
|
||||
#
|
||||
# Environment variables for local bootstrapping:
|
||||
# GOROOT - Path to the lready installed Go runtime
|
||||
set -e
|
||||
|
||||
# Download, verify and install the root distribution
|
||||
# Download, verify and install the root distribution if pulled remotely
|
||||
if [ "$GOROOT" == "" ]; then
|
||||
$FETCH $ROOT_DIST $ROOT_DIST_SHA1
|
||||
|
||||
tar -C /usr/local -xzf `basename $ROOT_DIST`
|
||||
rm -f `basename $ROOT_DIST`
|
||||
|
||||
export GOROOT=/usr/local/go
|
||||
fi
|
||||
export GOROOT_BOOTSTRAP=$GOROOT
|
||||
|
||||
# Pre-build all guest distributions based on the root distribution
|
||||
|
43
docker/base/bootstrap_repo.sh
Normal file
43
docker/base/bootstrap_repo.sh
Normal file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Contains the Go tool-chain source repository bootstrapper, that builds and
|
||||
# bootstraps a Go environment from the official GitHub repository, opposed to
|
||||
# using pre-build packages.
|
||||
#
|
||||
# Usage: bootstrap_repo.sh <branch>
|
||||
#
|
||||
# Needed environment variables:
|
||||
# FETCH - Remote file fetcher and checksum verifier (injected by image)
|
||||
set -e
|
||||
|
||||
# Prepare the image for manual Go compilation
|
||||
apt-get install -y netbase --no-install-recommends # Needed for `net` tests
|
||||
apt-get remove -y clang # Broken thread sanitizer
|
||||
|
||||
# Define the paths to deploy the bootstrapper and the final distribution
|
||||
export GOROOT=/usr/local/go
|
||||
export GOROOT_BOOTSTRAP=${GOROOT}-boot
|
||||
|
||||
# Download and install the Go bootstrap distribution
|
||||
BOOT_DIST=https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz
|
||||
BOOT_DIST_SHA1=332b64236d30a8805fc8dd8b3a269915b4c507fe
|
||||
|
||||
$FETCH $BOOT_DIST $BOOT_DIST_SHA1
|
||||
|
||||
tar -C /usr/local -xzf `basename $BOOT_DIST`
|
||||
rm -f `basename $BOOT_DIST`
|
||||
mv $GOROOT $GOROOT_BOOTSTRAP
|
||||
|
||||
# Download, build and install the requesed Go sources
|
||||
(cd /usr/local && git clone https://go.googlesource.com/go)
|
||||
(cd $GOROOT && git checkout $1)
|
||||
(cd $GOROOT/src && ./all.bash)
|
||||
|
||||
rm -rf $GOROOT_BOOTSTRAP && \
|
||||
export GOROOT_BOOTSTRAP=$GOROOT && \
|
||||
|
||||
# Restore the original image and bootstrap Go
|
||||
apt-get install -y clang --no-install-recommends
|
||||
apt-get remove -y netbase
|
||||
|
||||
$BOOTSTRAP_PURE
|
12
docker/go-develop/Dockerfile
Normal file
12
docker/go-develop/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
# Go cross compiler (xgo): Go develop layer
|
||||
# Copyright (c) 2015 Péter Szilágyi. All rights reserved.
|
||||
#
|
||||
# Released under the MIT license.
|
||||
|
||||
FROM karalabe/xgo-base
|
||||
|
||||
MAINTAINER Péter Szilágyi <peterke@gmail.com>
|
||||
|
||||
# Clone and bootstrap the latest Go develop branch
|
||||
RUN $BOOTSTRAP_REPO master
|
||||
ENV GO_VERSION 999
|
Loading…
x
Reference in New Issue
Block a user