Update docker/build.sh script to use glide & make (#3079)

* docker: update build script to use glide + make

- docker/build.sh will now use glide to fetch dependencies
- glide is built from source to keep compatibility with arm
  (no pre-prebuilt binary for arm)
- docker/build.sh will also now use the provided Makefile
  It will generate an error when trying to get git build has as we do
  not ship the 88mo .git directory during the build (should not cause
  any problem as the variable it sets was not set previously)

* docker: fix docker arm build

- drop gosu version back to 1.7 as gosu binary for armhf is broken
- see tianon/gosu#19

* docker: update gosu to 1.9

Signed-off-by: Jean-Philippe Roemer <jp@roemer.im>
release/v1.15
Jean-Philippe Roemer 2016-05-11 18:11:59 +01:00 committed by Unknwon
parent bf5faf76eb
commit bcd4adb3a0
4 changed files with 20 additions and 13 deletions

View File

@ -1,7 +1,5 @@
.git .git
.git/** .git/**
conf
conf/**
packager packager
packager/** packager/**
scripts scripts
@ -9,13 +7,13 @@ scripts/**
.github/ .github/
.github/** .github/**
config.codekit config.codekit
LICENSE
Makefile
.dockerignore .dockerignore
*.yml *.yml
*.md *.md
.bra.toml .bra.toml
.editorconfig .editorconfig
.gitignore .gitignore
.gopmfile
Dockerfile* Dockerfile*
vendor
vendor/**
gogs

View File

@ -2,7 +2,7 @@ FROM alpine:3.3
MAINTAINER jp@roemer.im MAINTAINER jp@roemer.im
# Install system utils & Gogs runtime dependencies # Install system utils & Gogs runtime dependencies
ADD https://github.com/tianon/gosu/releases/download/1.7/gosu-amd64 /usr/sbin/gosu ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64 /usr/sbin/gosu
RUN chmod +x /usr/sbin/gosu \ RUN chmod +x /usr/sbin/gosu \
&& apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat && apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat

View File

@ -2,7 +2,7 @@ FROM hypriot/rpi-alpine-scratch:v3.2
MAINTAINER jp@roemer.im, raxetul@gmail.com MAINTAINER jp@roemer.im, raxetul@gmail.com
# Install system utils & Gogs runtime dependencies # Install system utils & Gogs runtime dependencies
ADD https://github.com/tianon/gosu/releases/download/1.7/gosu-armhf /usr/sbin/gosu ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-armhf /usr/sbin/gosu
RUN chmod +x /usr/sbin/gosu \ RUN chmod +x /usr/sbin/gosu \
&& echo "http://dl-4.alpinelinux.org/alpine/v3.3/main/" | tee /etc/apk/repositories \ && echo "http://dl-4.alpinelinux.org/alpine/v3.3/main/" | tee /etc/apk/repositories \
&& echo "http://dl-4.alpinelinux.org/alpine/v3.3/community/" | tee -a /etc/apk/repositories \ && echo "http://dl-4.alpinelinux.org/alpine/v3.3/community/" | tee -a /etc/apk/repositories \

View File

@ -5,19 +5,28 @@ set -e
# Set temp environment vars # Set temp environment vars
export GOPATH=/tmp/go export GOPATH=/tmp/go
export PATH=${PATH}:${GOPATH}/bin export PATH=${PATH}:${GOPATH}/bin
export GO15VENDOREXPERIMENT=1
# Install build deps # Install build deps
apk --no-cache --no-progress add --virtual build-deps linux-pam-dev go gcc musl-dev apk --no-cache --no-progress add --virtual build-deps build-base linux-pam-dev go
# Init go environment to build Gogs # Install glide
git clone -b 0.10.2 https://github.com/Masterminds/glide ${GOPATH}/src/github.com/Masterminds/glide
cd ${GOPATH}/src/github.com/Masterminds/glide
make build
go install
# Build Gogs
mkdir -p ${GOPATH}/src/github.com/gogits/ mkdir -p ${GOPATH}/src/github.com/gogits/
ln -s /app/gogs/ ${GOPATH}/src/github.com/gogits/gogs ln -s /app/gogs/ ${GOPATH}/src/github.com/gogits/gogs
cd ${GOPATH}/src/github.com/gogits/gogs cd ${GOPATH}/src/github.com/gogits/gogs
go get -v -tags "sqlite cert pam" glide install
go build -tags "sqlite cert pam" make build TAGS="sqlite cert pam"
# Cleanup GOPATH # Cleanup GOPATH & vendoring dir
rm -r $GOPATH rm -r $GOPATH /app/gogs/vendor
# Remove build deps # Remove build deps
apk --no-progress del build-deps apk --no-progress del build-deps