forked from shiyanlou/trylab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (66 loc) · 2.58 KB
/
Dockerfile
File metadata and controls
72 lines (66 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM buildpack-deps:stretch
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends \
gnupg2 \
dirmngr \
; \
rm -rf /var/lib/apt/lists/*
# https://gcc.gnu.org/mirrors.html
ENV GPG_KEYS \
B215C1633BCA0477615F1B35A5B3A004745C015A \
B3C42148A44E6983B3E4CC0793FA9B1AB75C61B8 \
90AA470469D3965A87A5DCB494D03953902C9419 \
80F98B2E0DAB6C8281BDF541A7C8C3B2F71EDF1C \
7F74F97C103468EE5D750B583AB00996FC26A641 \
33C235A34C46AA3FFB293709A328C3A2C3C45C06
RUN set -ex; \
for key in $GPG_KEYS; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done
# Last Modified: 2017-05-02
ENV GCC_VERSION 7.1.0
# Docker EOL: 2018-05-02
RUN set -ex \
&& buildDeps=' \
dpkg-dev \
flex \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& rm -r /var/lib/apt/lists/* \
&& curl -fSL "http://ftpmirror.gnu.org/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2" -o gcc.tar.bz2 \
&& curl -fSL "http://ftpmirror.gnu.org/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2.sig" -o gcc.tar.bz2.sig \
&& gpg --batch --verify gcc.tar.bz2.sig gcc.tar.bz2 \
&& mkdir -p /usr/src/gcc \
&& tar -xf gcc.tar.bz2 -C /usr/src/gcc --strip-components=1 \
&& rm gcc.tar.bz2* \
&& cd /usr/src/gcc \
# "download_prerequisites" pulls down a bunch of tarballs and extracts them,
# but then leaves the tarballs themselves lying around
&& ./contrib/download_prerequisites \
&& { rm *.tar.* || true; } \
# explicitly update autoconf config.guess and config.sub so they support more arches/libcs
&& wget -O config.guess "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" \
&& wget -O config.sub "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" \
&& dir="$(mktemp -d)" \
&& cd "$dir" \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& /usr/src/gcc/configure \
--build="$gnuArch" \
--disable-multilib \
--enable-languages=c,c++,fortran,go \
&& make -j"$(nproc)" \
&& make install-strip \
&& cd .. \
&& rm -rf "$dir" \
&& apt-get purge -y --auto-remove $buildDeps
# gcc installs .so files in /usr/local/lib64...
RUN echo '/usr/local/lib64' > /etc/ld.so.conf.d/local-lib64.conf \
&& ldconfig -v
# ensure that alternatives are pointing to the new compiler and that old one is no longer used
RUN set -x \
&& dpkg-divert --divert /usr/bin/gcc.orig --rename /usr/bin/gcc \
&& dpkg-divert --divert /usr/bin/g++.orig --rename /usr/bin/g++ \
&& dpkg-divert --divert /usr/bin/gfortran.orig --rename /usr/bin/gfortran \
&& update-alternatives --install /usr/bin/cc cc /usr/local/bin/gcc 999