From 1a16fc126e3f92119bfce3b4bffd16614df41374 Mon Sep 17 00:00:00 2001 From: Matt Boersma Date: Thu, 3 May 2018 13:03:47 -0600 Subject: [PATCH] ref(Dockerfile,README): rebase image on Ubuntu:16.04 --- README.md | 32 +++++++++--------- rootfs/Dockerfile | 84 ++++++++++++++++++++++++++--------------------- 2 files changed, 63 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 53dfe2b..e868b6d 100644 --- a/README.md +++ b/README.md @@ -10,29 +10,30 @@ creating [issues][] and submitting [pull requests][]. ## Image Contents -* based on the [official go Docker image][] -* [dep][]: go dependency management tool -* [gb][]: project-based build tool for go -* [ginkgo][]: BDD testing framework for go -* [glide][]: go dependency management tool -* [golint][]: go source code linter -* [gox][]: simple go cross-compiling tool +* based on the [official Go Docker image][] +* [az][]: Azure cloud command-line tool +* [dep][]: Go dependency management tool +* [Docker][]: Docker binaries to be able to bind mount /var/run/docker.sock in the dev environment container +* [gb][]: project-based build tool for Go +* [ginkgo][]: BDD testing framework for Go +* [glide][]: Go dependency management tool +* [golint][]: Go source code linter +* [gometalinter][]: run Go lint tools concurrently +* [gox][]: simple Go cross-compiling tool * [helm][]: Kubernetes package manager * [jq][]: command-line JSON processor * [jwt][]: tool for creating and parsing JSON Web Tokens * [kubectl][]: Kubernetes command-line client +* [ruby][]: ruby scripting language * [shellcheck][]: static analysis for shell scripts * [shyaml][]: YAML access from the command line -* [test-cover.sh][]: test coverage for multiple go packages +* [test-cover.sh][]: test coverage for multiple Go packages * [upx][]: executable packer -* [az][]: Azure cloud command-line tool -* [Docker][]: Docker binaries to be able to bind mount /var/run/docker.sock in the dev environment container * [vim][]: text editor -* [ruby][]: ruby scripting language ## Usage -Mount your local go code into a container's `$GOPATH` to run any `go` command or one of the +Mount your local Go code into a container's `$GOPATH` to run any `go` command or one of the included tools or scripts. Here's an example of running `glide up` for deis/builder: ```console @@ -59,25 +60,26 @@ The latest deis/go-dev Docker image is available at: [Deis Workflow]: https://deis.com/ [dep]: https://github.com/golang/dep [Docker Hub]: https://hub.docker.com +[Docker]: http://www.docker.com [gb]: https://github.com/constabulary/gb/ [gen-changelog.sh]: https://github.com/deis/docker-go-dev/tree/master/rootfs/usr/local/bin/gen-changelog.sh [ginkgo]: https://github.com/onsi/ginkgo [glide]: https://github.com/Masterminds/glide [Go]: https://golang.org/ [golint]: https://github.com/golang/lint +[gometalinter]: https://github.com/alecthomas/gometalinter [gox]: https://github.com/mitchellh/gox [helm]: https://github.com/kubernetes/helm [issues]: https://github.com/deis/docker-go-dev/issues [jq]: https://stedolan.github.io/jq/ [jwt]: https://github.com/dgrijalva/jwt-go [kubectl]: https://kubernetes.io/docs/user-guide/kubectl-overview/ -[official go Docker image]: https://hub.docker.com/_/golang/ +[official Go Docker image]: https://hub.docker.com/_/golang/ [pull requests]: https://github.com/deis/docker-go-dev/pulls [Quay.io]: https://quay.io +[ruby]: https://www.ruby-lang.org/ [shellcheck]: https://github.com/koalaman/shellcheck [shyaml]: https://github.com/0k/shyaml [test-cover.sh]: https://github.com/deis/docker-go-dev/tree/master/rootfs/usr/local/bin/test-cover.sh [upx]: http://upx.sourceforge.net/ -[Docker]: http://www.docker.com [vim]: http://www.vim.org/ -[ruby]: https://www.ruby-lang.org/ \ No newline at end of file diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index 4745c55..4a1bf31 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/deis/base:v0.3.6 +FROM ubuntu:16.04 ENV AZCLI_VERSION=2.0.30 \ GO_VERSION=1.10.1 \ @@ -11,29 +11,39 @@ ENV AZCLI_VERSION=2.0.30 \ PATH=$PATH:/usr/local/go/bin:/go/bin:/usr/local/bin/docker \ GOPATH=/go -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - build-essential \ - git-core \ - mercurial \ - util-linux \ - jq \ - libffi-dev \ - libssl-dev \ - man \ - python \ - python-dev \ - python-pip \ - python-setuptools \ - unzip \ - upx \ - wget \ - zip \ - openssh-client \ - rsync \ - vim \ - ruby \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* \ +# This is a huge one-liner to optimize the Docker image layer. +# We disable source repos to speed up apt-get update. +RUN \ + sed -i -e 's/^deb-src/#deb-src/' /etc/apt/sources.list && \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get upgrade -y --no-install-recommends && \ + apt-get install -y --no-install-recommends \ + bash \ + build-essential \ + ca-certificates \ + curl \ + git-core \ + jq \ + libffi-dev \ + libssl-dev \ + man \ + mercurial \ + net-tools \ + openssh-client \ + procps \ + python \ + python-dev \ + python-pip \ + python-setuptools \ + rsync \ + ruby \ + unzip \ + upx \ + util-linux \ + vim \ + wget \ + zip \ && curl -L https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz | tar -C /usr/local -xz \ && curl -sSL https://github.com/Masterminds/glide/releases/download/$GLIDE_VERSION/glide-$GLIDE_VERSION-linux-amd64.tar.gz \ | tar -vxz -C /usr/local/bin --strip=1 \ @@ -50,30 +60,28 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | tar -vxz -C /usr/local/bin --strip=1 \ && mkdir -p /go/bin \ && curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh \ - && apt-get purge -y --auto-remove \ - unzip \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc \ && curl -fsSLO https://get.docker.com/builds/Linux/x86_64/docker-17.05.0-ce.tgz \ && tar xzvf docker-17.05.0-ce.tgz -C /usr/local/bin \ && chmod +x -R /usr/local/bin/docker \ && rm docker-17.05.0-ce.tgz \ && go get -u -v \ - github.com/onsi/ginkgo/ginkgo \ - github.com/mitchellh/gox \ - github.com/golang/protobuf/protoc-gen-go \ - github.com/haya14busa/goverage \ - github.com/constabulary/gb/... \ - github.com/dgrijalva/jwt-go/cmd/jwt \ - github.com/axw/gocov/gocov \ - github.com/AlekSi/gocov-xml \ + github.com/AlekSi/gocov-xml \ + github.com/axw/gocov/gocov \ + github.com/constabulary/gb/... \ + github.com/dgrijalva/jwt-go/cmd/jwt \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/haya14busa/goverage \ + github.com/mitchellh/gox \ + github.com/onsi/ginkgo/ginkgo \ && curl -fsSLO https://github.com/alecthomas/gometalinter/releases/download/v${GOMETALINTER_VERSION}/gometalinter-${GOMETALINTER_VERSION}-linux-amd64.tar.gz \ && tar xzvf gometalinter-${GOMETALINTER_VERSION}-linux-amd64.tar.gz --strip-components=1 -C /usr/local/bin \ && ln -s /usr/local/bin/gometalinter /usr/local/bin/gometalinter.v2 \ && rm gometalinter-${GOMETALINTER_VERSION}-linux-amd64.tar.gz \ && pip install --disable-pip-version-check --no-cache-dir azure-cli==${AZCLI_VERSION} shyaml \ - && apt-get purge --auto-remove -y libffi-dev python-dev python-pip + && apt-get purge --auto-remove -y libffi-dev python-dev python-pip unzip \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc WORKDIR /go