Lock to specific dep version

This changes the Dockerfile to install the same specific dep version
we use in CI. To ensure we don't end up duplicating logic, it refactors
the versions themselves into a separate sourceable script that's shared
between both the Dockerfile and our existing CI scripts.
This commit is contained in:
joeduffy 2018-09-29 14:36:34 -07:00
parent 162157c1a7
commit b6724c7892
3 changed files with 21 additions and 12 deletions

View file

@ -1,15 +1,21 @@
# Build the image in a distinct stage so we don't need the Golang SDK.
FROM golang:1.11-stretch as builder
# Change directories and place the minimal build scripts we need to start installing things.
WORKDIR /go/src/github.com/pulumi/pulumi
COPY ./build/ ./build/
# Install pre-reqs.
# - Update apt-get sources
RUN apt-get update -y
# - Dep, for Go package management
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
RUN . ./build/tool-versions.sh && \
curl -L -o "$(go env GOPATH)/bin/dep" \
https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 && \
chmod +x "$(go env GOPATH)/bin/dep"
# Copy the source code over, restore dependencies, and get ready to build everything. We copy the Gopkg
# files explicitly first to avoid excessive rebuild times when dependencies did not change.
WORKDIR /go/src/github.com/pulumi/pulumi
COPY Gopkg.* ./
RUN dep ensure -v --vendor-only
COPY . .
@ -23,7 +29,8 @@ RUN cd sdk/go && make install_plugin
RUN cd sdk/nodejs && make install_plugin
RUN cd sdk/python && make install_plugin
# Install and run in Alpine Linux.
# Install and run in Debian Stretch (to match the builder stage).
# TODO[pulumi/pulumi#1986]: consider switching to, or supporting, Alpine Linux for smaller image sizes.
FROM debian:stretch
# Copy over the binaries built during the prior stage.

8
build/tool-versions.sh Normal file
View file

@ -0,0 +1,8 @@
YARN_VERSION="1.3.2"
DEP_VERSION="0.4.1"
GOMETALINTER_VERSION="2.0.3"
PIP_VERSION="10.0.0"
VIRTUALENV_VERSION="15.2.0"
AWSCLI_VERSION="1.14.30"
WHEEL_VERSION="0.30.0"
TWINE_VERSION="1.9.1"

View file

@ -5,17 +5,11 @@ nvm install ${NODE_VERSION-v8.11.1}
# they would be set in the outer shell as well, so do as much logic as
# we can in a subshell.
(
set -o nounset -o errexit -o pipefail
set -o errexit -o pipefail
[ -e "$(go env GOPATH)/bin" ] || mkdir -p "$(go env GOPATH)/bin"
YARN_VERSION="1.3.2"
DEP_VERSION="0.4.1"
GOMETALINTER_VERSION="2.0.3"
PIP_VERSION="10.0.0"
VIRTUALENV_VERSION="15.2.0"
AWSCLI_VERSION="1.14.30"
WHEEL_VERSION="0.30.0"
TWINE_VERSION="1.9.1"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
. ${DIR}/../tool-versions.sh
OS=""
case $(uname) in