From 1841316f188538b572c784b6875a89f63a83c513 Mon Sep 17 00:00:00 2001 From: yaourt Date: Sun, 19 Feb 2017 02:43:27 +0100 Subject: Provide an updated Dockerfile where Gogs is build with Go 1.8 (#4151) In order to have an up to date Docker image based on alpine 3.5 and having Gogs built with Go 1.8 Refs: [ #4145 ] --- docker/build-go.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 docker/build-go.sh (limited to 'docker/build-go.sh') diff --git a/docker/build-go.sh b/docker/build-go.sh new file mode 100755 index 00000000..22e3724d --- /dev/null +++ b/docker/build-go.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Build GO version as specified in Dockerfile + +set -x +set -e + +# Components versions +export GOLANG_VERSION="1.8" +export GOLANG_SRC_URL="https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz" +export GOLANG_SRC_SHA256="406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5ef5c623596" + + +# Install build tools +apk add --no-cache --no-progress --virtual build-deps-go gcc musl-dev openssl go + +export GOROOT_BOOTSTRAP="$(go env GOROOT)" + +# Download Go +wget -q "$GOLANG_SRC_URL" -O golang.tar.gz +echo "$GOLANG_SRC_SHA256 golang.tar.gz" | sha256sum -c - +tar -C /usr/local -xzf golang.tar.gz +rm golang.tar.gz + +# Build +cd /usr/local/go/src +# see https://golang.org/issue/14851 +patch -p2 -i /app/gogs/build/docker/no-pic.patch +./make.bash + +# Clean +rm /app/gogs/build/docker/*.patch +apk del build-deps-go -- cgit v1.2.3