1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:54:43 -07:00

dashboard: optimize linux docker image size

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/132590043
This commit is contained in:
Johan Euphrosine 2014-09-08 15:35:40 -07:00 committed by Brad Fitzpatrick
parent 159879b336
commit afc3bf64c0
8 changed files with 91 additions and 69 deletions

View File

@ -8,38 +8,9 @@ FROM debian:wheezy
MAINTAINER golang-dev <golang-dev@googlegroups.com>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y
# For running curl to get the hg starter tarballs (faster than hg clone).
RUN apt-get install -y --no-install-recommends curl ca-certificates
ADD /scripts/install-apt-deps.sh /scripts/
RUN /scripts/install-apt-deps.sh
# Optionally used by some net/http tests:
RUN apt-get install -y --no-install-recommends strace
# For building Go's bootstrap 'dist' program:
RUN apt-get install -y --no-install-recommends gcc libc6-dev
# For 32-bit builds:
# TODO(bradfitz): move these into a 386 image that derives from this one.
RUN apt-get install -y --no-install-recommends libc6-dev-i386 gcc-multilib
# For interacting with the Go source & subrepos:
RUN apt-get install -y --no-install-recommends mercurial git-core
ENV GOPATH /gopath
ENV GOROOT /goroot
RUN mkdir -p $GOROOT
RUN cd $GOROOT && curl -s https://storage.googleapis.com/gobuilder/go-snap.tar.gz | tar x --no-same-owner -zv
ENV GO_TOOLS $GOPATH/src/code.google.com/p/go.tools
RUN mkdir -p $GO_TOOLS
RUN cd $GO_TOOLS $ && curl -s https://storage.googleapis.com/gobuilder/go.tools-snap.tar.gz | tar x --no-same-owner -zv
RUN cd $GOROOT && hg pull && hg update -C b8ff0ec2a724
RUN cd $GOROOT/src && ./make.bash
RUN mkdir -p /usr/local/bin
RUN cd $GO_TOOLS && hg pull && hg update -C f9e37a924785
ENV GOBIN /usr/local/bin
RUN /goroot/bin/go install code.google.com/p/go.tools/dashboard/builder
ADD /scripts/build-go-builder.sh /scripts/
RUN GO_REV=073fc578434b BUILDER_REV=8845ca94a310 /scripts/build-go-builder.sh && test -f /usr/local/bin/builder

View File

@ -7,3 +7,6 @@ docker: Dockerfile
docker-linux.base.tar.gz: docker
docker save gobuilders/linux-x86-base | gzip | (cd ../../coordinator/buildongce && go run create.go --write_object=go-builder-data/docker-linux.base.tar.gz)
check: docker
docker run gobuilders/linux-x86-base /usr/local/bin/builder -rev=073fc578434b -buildroot=/ -v -report=false linux-amd64-temp

View File

@ -0,0 +1,20 @@
set -ex
export GOPATH=/gopath
export GOROOT=/goroot
PREFIX=/usr/local
: ${GO_REV:?"need to be set to the golang repo revision used to build the builder."}
: ${BUILDER_REV:?"need to be set to the go.tools repo revision for the builder."}
mkdir -p $GOROOT
curl -s https://storage.googleapis.com/gobuilder/go-snap.tar.gz | tar x --no-same-owner -zv -C $GOROOT
(cd $GOROOT/src && hg pull -r $GO_REV -u && find && ./make.bash)
GO_TOOLS=$GOPATH/src/code.google.com/p/go.tools
mkdir -p $GO_TOOLS
curl -s https://storage.googleapis.com/gobuilder/go.tools-snap.tar.gz | tar x --no-same-owner -zv -C $GO_TOOLS
mkdir -p $PREFIX/bin
(cd $GO_TOOLS && hg pull -r $BUILDER_REV -u && GOBIN=$PREFIX/bin /goroot/bin/go install code.google.com/p/go.tools/dashboard/builder)
rm -fR $GOROOT/bin $GOROOT/pkg $GOPATH

View File

@ -0,0 +1,17 @@
set -ex
apt-get update
# For running curl to get the hg starter tarballs (faster than hg clone).
apt-get install -y --no-install-recommends curl ca-certificates
# Optionally used by some net/http tests:
apt-get install -y --no-install-recommends strace
# For building Go's bootstrap 'dist' prog
apt-get install -y --no-install-recommends gcc libc6-dev
# For 32-bit builds:
# TODO(bradfitz): move these into a 386 image that derives from this one.
apt-get install -y --no-install-recommends libc6-dev-i386 gcc-multilib
# For interacting with the Go source & subrepos:
apt-get install -y --no-install-recommends mercurial git-core
apt-get clean
rm -fr /var/lib/apt/lists

View File

@ -16,44 +16,12 @@ MAINTAINER golang-dev <golang-dev@googlegroups.com>
ENV DEBIAN_FRONTEND noninteractive
RUN echo cachebuster4
RUN apt-get update && apt-get upgrade -y
ADD /scripts/install-apt-deps.sh /scripts/
RUN /scripts/install-apt-deps.sh
# For running curl to get the hg starter tarballs (faster than hg clone).
RUN apt-get install -y --no-install-recommends curl ca-certificates
ADD /scripts/build-go-builder.sh /scripts/
RUN GO_REV=073fc578434b BUILDER_REV=8845ca94a310 /scripts/build-go-builder.sh && test -f /usr/local/bin/builder
# For building Go's bootstrap 'dist' program:
RUN apt-get install -y --no-install-recommends gcc libc6-dev
# For interacting with the Go source & subrepos:
RUN apt-get install -y --no-install-recommends mercurial git-core
# For 32-bit nacl:
RUN apt-get install -y --no-install-recommends libc6-i386 libc6-dev-i386 lib32stdc++6 gcc-multilib
ENV GOPATH /gopath
ENV GOROOT /goroot
RUN mkdir -p $GOROOT
RUN cd $GOROOT && curl -s https://storage.googleapis.com/gobuilder/go-snap.tar.gz | tar x --no-same-owner -zv
ENV GO_TOOLS $GOPATH/src/code.google.com/p/go.tools
RUN mkdir -p $GO_TOOLS
RUN cd $GO_TOOLS $ && curl -s https://storage.googleapis.com/gobuilder/go.tools-snap.tar.gz | tar x --no-same-owner -zv
RUN cd $GOROOT && hg pull && hg update -C b8ff0ec2a724
RUN cd $GOROOT/src && ./make.bash
RUN mkdir -p /usr/local/bin
RUN cd $GO_TOOLS && hg pull && hg update -C f9e37a924785
ENV GOBIN /usr/local/bin
RUN /goroot/bin/go install code.google.com/p/go.tools/dashboard/builder
RUN cd /usr/local/bin && curl -s -O https://storage.googleapis.com/gobuilder/sel_ldr_x86_32 && chmod +x sel_ldr_x86_32
RUN cd /usr/local/bin && curl -s -O https://storage.googleapis.com/gobuilder/sel_ldr_x86_64 && chmod +x sel_ldr_x86_64
RUN ln -s $GOROOT/misc/nacl/go_nacl_386_exec /usr/local/bin/
RUN ln -s $GOROOT/misc/nacl/go_nacl_amd64p32_exec /usr/local/bin/
ADD build-command.pl /usr/local/bin/
ENV PATH /usr/local/bin:$GOROOT/bin:$PATH

View File

@ -7,3 +7,6 @@ docker: Dockerfile
upload: docker
docker save gobuilders/linux-x86-nacl | gzip | (cd ../../coordinator/buildongce && go run create.go --write_object=go-builder-data/docker-linux.nacl.tar.gz)
check: docker
docker run gobuilders/linux-x86-nacl /usr/local/bin/builder -rev=073fc578434b -buildroot=/ -v -cmd=/usr/local/bin/build-command.pl -report=false nacl-amd64p32-temp

View File

@ -0,0 +1,26 @@
set -ex
export GOPATH=/gopath
export GOROOT=/goroot
PREFIX=/usr/local
: ${GO_REV:?"need to be set to the golang repo revision used to build the builder."}
: ${BUILDER_REV:?"need to be set to the go.tools repo revision for the builder."}
mkdir -p $GOROOT
curl -s https://storage.googleapis.com/gobuilder/go-snap.tar.gz | tar x --no-same-owner -zv -C $GOROOT
(cd $GOROOT/src && hg pull -r $GO_REV -u && find && ./make.bash)
GO_TOOLS=$GOPATH/src/code.google.com/p/go.tools
mkdir -p $GO_TOOLS
curl -s https://storage.googleapis.com/gobuilder/go.tools-snap.tar.gz | tar x --no-same-owner -zv -C $GO_TOOLS
mkdir -p $PREFIX/bin
(cd $GO_TOOLS && hg pull -r $BUILDER_REV -u && GOBIN=$PREFIX/bin /goroot/bin/go install code.google.com/p/go.tools/dashboard/builder)
rm -fR $GOROOT/bin $GOROOT/pkg $GOPATH
(cd /usr/local/bin && curl -s -O https://storage.googleapis.com/gobuilder/sel_ldr_x86_32 && chmod +x sel_ldr_x86_32)
(cd /usr/local/bin && curl -s -O https://storage.googleapis.com/gobuilder/sel_ldr_x86_64 && chmod +x sel_ldr_x86_64)
ln -s $GOROOT/misc/nacl/go_nacl_386_exec /usr/local/bin/
ln -s $GOROOT/misc/nacl/go_nacl_amd64p32_exec /usr/local/bin/

View File

@ -0,0 +1,14 @@
set -ex
apt-get update
# For running curl to get the hg starter tarballs (faster than hg clone).
apt-get install -y --no-install-recommends curl ca-certificates
# For building Go's bootstrap 'dist' prog
apt-get install -y --no-install-recommends gcc libc6-dev
# For interacting with the Go source & subrepos:
apt-get install -y --no-install-recommends mercurial git-core
# For 32-bit nacl:
apt-get install -y --no-install-recommends libc6-i386 libc6-dev-i386 lib32stdc++6 gcc-multilib
apt-get clean
rm -fr /var/lib/apt/lists