From bcd4adb3a0b59581ee3ddca2c31ae8d339b92cfd Mon Sep 17 00:00:00 2001 From: Jean-Philippe Roemer Date: Wed, 11 May 2016 18:11:59 +0100 Subject: [PATCH] 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 --- .dockerignore | 8 +++----- Dockerfile | 2 +- Dockerfile.rpi | 2 +- docker/build.sh | 21 +++++++++++++++------ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.dockerignore b/.dockerignore index 092eef43c..b33dbf58a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,5 @@ .git .git/** -conf -conf/** packager packager/** scripts @@ -9,13 +7,13 @@ scripts/** .github/ .github/** config.codekit -LICENSE -Makefile .dockerignore *.yml *.md .bra.toml .editorconfig .gitignore -.gopmfile Dockerfile* +vendor +vendor/** +gogs diff --git a/Dockerfile b/Dockerfile index 8853eab51..e45c0c065 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.3 MAINTAINER jp@roemer.im # 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 \ && apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat diff --git a/Dockerfile.rpi b/Dockerfile.rpi index 6e2c4264b..948f8f178 100644 --- a/Dockerfile.rpi +++ b/Dockerfile.rpi @@ -2,7 +2,7 @@ FROM hypriot/rpi-alpine-scratch:v3.2 MAINTAINER jp@roemer.im, raxetul@gmail.com # 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 \ && 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 \ diff --git a/docker/build.sh b/docker/build.sh index 0bf5c0131..da36d7e6e 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -5,19 +5,28 @@ set -e # Set temp environment vars export GOPATH=/tmp/go export PATH=${PATH}:${GOPATH}/bin +export GO15VENDOREXPERIMENT=1 # 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/ ln -s /app/gogs/ ${GOPATH}/src/github.com/gogits/gogs cd ${GOPATH}/src/github.com/gogits/gogs -go get -v -tags "sqlite cert pam" -go build -tags "sqlite cert pam" +glide install +make build TAGS="sqlite cert pam" -# Cleanup GOPATH -rm -r $GOPATH +# Cleanup GOPATH & vendoring dir +rm -r $GOPATH /app/gogs/vendor # Remove build deps apk --no-progress del build-deps