1 # Copyright 2020 The Go Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style
3 # license that can be found in the LICENSE file.
4
5 # Run this using build.sh.
6
7 ARG ubuntu=ubuntu
8 FROM $ubuntu:focal
9
10 RUN mkdir /boring
11 WORKDIR /boring
12
13 ENV LANG=C
14 ENV LANGUAGE=
15
16 # Following NIST submission draft dated July 3, 2021.
17 # This corresponds to boringssl.googlesource.com/boringssl tag fips-20210429.
18 ENV ClangV=12
19 RUN apt-get update && \
20 apt-get install --no-install-recommends -y cmake xz-utils wget unzip ca-certificates clang-$ClangV python
21
22 # Download, validate, unpack, build, and install Ninja.
23 ENV NinjaV=1.10.2
24 ENV NinjaH=ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed
25 RUN \
26 wget https://github.com/ninja-build/ninja/archive/refs/tags/v$NinjaV.tar.gz && \
27 echo "$NinjaH v$NinjaV.tar.gz" >sha && sha256sum -c sha && \
28 tar -xzf v$NinjaV.tar.gz && \
29 rm v$NinjaV.tar.gz && \
30 cd ninja-$NinjaV && \
31 CC=clang-$ClangV CXX=clang++-$ClangV ./configure.py --bootstrap && \
32 mv ninja /usr/local/bin/
33
34 # Download, validate, unpack, and install Go.
35 ARG GOARCH
36 ENV GoV=1.16.5
37 ENV GoHamd64=b12c23023b68de22f74c0524f10b753e7b08b1504cb7e417eccebdd3fae49061
38 ENV GoHarm64=d5446b46ef6f36fdffa852f73dfbbe78c1ddf010b99fa4964944b9ae8b4d6799
39 RUN \
40 eval GoH=\${GoH$GOARCH} && \
41 wget https://golang.org/dl/go$GoV.linux-$GOARCH.tar.gz && \
42 echo "$GoH go$GoV.linux-$GOARCH.tar.gz" >sha && sha256sum -c sha && \
43 tar -C /usr/local -xzf go$GoV.linux-$GOARCH.tar.gz && \
44 rm go$GoV.linux-$GOARCH.tar.gz && \
45 ln -s /usr/local/go/bin/go /usr/local/bin/
46
47 # Download, validate, and unpack BoringCrypto.
48 ENV BoringV=853ca1ea1168dff08011e5d42d94609cc0ca2e27
49 ENV BoringH=a4d069ccef6f3c7bc0c68de82b91414f05cb817494cd1ab483dcf3368883c7c2
50 RUN \
51 wget https://commondatastorage.googleapis.com/chromium-boringssl-fips/boringssl-$BoringV.tar.xz && \
52 echo "$BoringH boringssl-$BoringV.tar.xz" >sha && sha256sum -c sha && \
53 tar xJf boringssl-$BoringV.tar.xz
54
55 # Build BoringCrypto.
56 ADD build-boring.sh /boring/build-boring.sh
57 RUN /boring/build-boring.sh
58
59 # Build Go BoringCrypto syso.
60 # build.sh copies it back out of the Docker image.
61 ADD goboringcrypto.h /boring/godriver/goboringcrypto.h
62 ADD build-goboring.sh /boring/build-goboring.sh
63 RUN /boring/build-goboring.sh
64
View as plain text