github.com/vmware/govmomi@v0.51.0/gen/Dockerfile (about) 1 ## The version of Go from which this image is based. 2 ARG GO_VERSION=1.23.2 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 60 RUN gem install bundler -v 2.4.22 61 62 63 ## -------------------------------------- 64 ## Configure the working directory 65 ## -------------------------------------- 66 67 WORKDIR /govmomi/gen 68 69 70 ## -------------------------------------- 71 ## Cache the gen program dependencies 72 ## -------------------------------------- 73 74 COPY Gemfile Gemfile.lock . 75 RUN bundle update --bundler && bundle install 76 77 78 ## -------------------------------------- 79 ## Install goimports to forma gen'd files 80 ## -------------------------------------- 81 82 RUN go install golang.org/x/tools/cmd/goimports@latest