github.com/vmware/govmomi@v0.37.1/gen/Dockerfile (about) 1 ## The version of Go from which this image is based. 2 ARG GO_VERSION=1.20.6 3 4 ## Docker image used as base of this image. 5 FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} 6 7 8 ## -------------------------------------- 9 ## Multi-platform support 10 ## -------------------------------------- 11 12 ARG TARGETOS 13 ARG TARGETARCH 14 15 16 ## -------------------------------------- 17 ## Environment variables 18 ## -------------------------------------- 19 20 ENV GOOS=${TARGETOS} 21 ENV GOARCH=${TARGETARCH} 22 23 24 ## -------------------------------------- 25 ## Update the apt cache & essentials 26 ## -------------------------------------- 27 RUN apt-get update && \ 28 apt-get install -y build-essential curl 29 30 31 ## -------------------------------------- 32 ## Install the version of openssl 33 ## required by ruby 2.x, which is 34 ## required to generate the types 35 ## -------------------------------------- 36 RUN mkdir -p /opt/src /opt/lib && \ 37 curl -sSL https://www.openssl.org/source/openssl-1.1.1g.tar.gz | \ 38 tar -C /opt/src -xz && \ 39 cd /opt/src/openssl-1.1.1g && \ 40 ./config --prefix=/opt/lib/openssl-1.1.1g \ 41 --openssldir=/opt/lib/openssl-1.1.1g && \ 42 make && \ 43 make install && \ 44 rm -fr /opt/lib/openssl-1.1.1g/certs && \ 45 ln -s /etc/ssl/certs /opt/lib/openssl-1.1.1g/certs 46 47 48 ## -------------------------------------- 49 ## Install Ruby & Bundler 50 ## -------------------------------------- 51 52 ENV PATH="/root/.rbenv/shims:${PATH}" \ 53 RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/lib/openssl-1.1.1g" 54 55 RUN apt-get install -y rbenv && \ 56 rbenv install 2.7.6 && \ 57 rbenv rehash && \ 58 rbenv global 2.7.6 && \ 59 gem install bundler 60 61 62 ## -------------------------------------- 63 ## Configure the working directory 64 ## -------------------------------------- 65 66 WORKDIR /govmomi/gen 67 68 69 ## -------------------------------------- 70 ## Cache the gen program dependencies 71 ## -------------------------------------- 72 73 COPY Gemfile Gemfile.lock . 74 RUN go install golang.org/x/tools/cmd/goimports@latest && \ 75 bundle update --bundler && \ 76 bundle install