mirror of https://github.com/gogits/gogs.git
Browse Source
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 ]pull/4153/head
yaourt
8 years ago
committed by
无闻
5 changed files with 83 additions and 9 deletions
@ -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 |
@ -0,0 +1,22 @@
|
||||
#!/bin/sh |
||||
# Finalize the build |
||||
|
||||
set -x |
||||
set -e |
||||
|
||||
# Move to final place |
||||
mv /app/gogs/build/gogs /app/gogs/ |
||||
mv /app/gogs/build/templates /app/gogs/ |
||||
mv /app/gogs/build/public /app/gogs/ |
||||
mv /app/gogs/build/docker /app/gogs/ |
||||
|
||||
# Final cleaning |
||||
rm -rf /app/gogs/build |
||||
rm /app/gogs/docker/build.sh |
||||
rm /app/gogs/docker/build-go.sh |
||||
rm /app/gogs/docker/finalize.sh |
||||
rm /app/gogs/docker/nsswitch.conf |
||||
rm /app/gogs/docker/README.md |
||||
|
||||
rm -rf /tmp/go |
||||
rm -rf /usr/local/go |
@ -0,0 +1,16 @@
|
||||
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
|
||||
index 14f4fa9..5599307 100644
|
||||
--- a/src/cmd/link/internal/ld/lib.go
|
||||
+++ b/src/cmd/link/internal/ld/lib.go
|
||||
@@ -1272,6 +1272,11 @@ func hostlink() {
|
||||
argv = append(argv, peimporteddlls()...)
|
||||
}
|
||||
|
||||
+ // The Go linker does not currently support building PIE
|
||||
+ // executables when using the external linker. See:
|
||||
+ // https://github.com/golang/go/issues/6940
|
||||
+ argv = append(argv, "-fno-PIC")
|
||||
+
|
||||
if l.Debugvlog != 0 {
|
||||
l.Logf("%5.2f host link:", obj.Cputime())
|
||||
for _, v := range argv {
|
Loading…
Reference in new issue