-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile.amd64
94 lines (76 loc) · 3.55 KB
/
Dockerfile.amd64
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
FROM centos:6
MAINTAINER Fabian Stäber, [email protected]
#------------------------------------------------------------------------------
# Why centos:6
#------------------------------------------------------------------------------
# When compiled on current Linux versions, grok_exporter requires GLIBC_2.14, see
# output of 'objdump -p grok_exporter'. The reason why older GLIBC versions don't
# work is a call to memcpy, see output of 'objdump -T grok_exporter | grep GLIBC_2.14'.
# Centos 6 does not provide GLIBC_2.14. In order to make grok_exporter work on
# old Linux distributions like Centos 6, we compile it on Centos 6 to make sure
# it doesn't accidentally require a newer GLIBC version.
#------------------------------------------------------------------------------
# Edit the LAST_UPDATE variable to force re-run of 'yum update' when building
# the Docker image
ENV LAST_UPDATE=2020-09-21
RUN yum clean all && \
yum update -y
#------------------------------------------------------------------------------
# Basic tools
#------------------------------------------------------------------------------
RUN yum install -y \
curl \
git \
wget \
vim
#------------------------------------------------------------------------------
# Go development
#------------------------------------------------------------------------------
# Install golang manually, so we get the latest version.
RUN cd /usr/local && \
curl --fail -sLO https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz && \
tar xfz go1.15.2.linux-amd64.tar.gz && \
rm go1.15.2.linux-amd64.tar.gz && \
cd / && \
mkdir -p go/bin go/pkg
ENV GOROOT="/usr/local/go" \
GOPATH="/go" \
GOCACHE=/tmp/.cache
ENV PATH="${GOROOT}/bin:${PATH}"
ENV PATH="${GOPATH}/bin:${PATH}"
#------------------------------------------------------------------------------
# Create a statically linked Oniguruma library for Windows amd64
#------------------------------------------------------------------------------
# Install compiler and cross-compile Oniguruma for mingw
# This will create /usr/x86_64-w64-mingw32/lib/libonig.a
RUN yum install -y epel-release && \
yum install -y gcc mingw64-gcc && \
cd /tmp && \
curl -sLO https://github.com/kkos/oniguruma/releases/download/v6.9.5_rev1/onig-6.9.5-rev1.tar.gz && \
tar xfz onig-6.9.5-rev1.tar.gz && \
rm onig-6.9.5-rev1.tar.gz && \
cd /tmp/onig-6.9.5 && \
CC=x86_64-w64-mingw32-gcc ./configure --host x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32 && \
CC=x86_64-w64-mingw32-gcc make && \
CC=x86_64-w64-mingw32-gcc make install && \
cd / && \
rm -r /tmp/onig-6.9.5
#------------------------------------------------------------------------------
# Create a statically linked Oniguruma library for Linux amd64
#------------------------------------------------------------------------------
# This will create /usr/local/lib/libonig.a
RUN cd /tmp && \
curl -sLO https://github.com/kkos/oniguruma/releases/download/v6.9.5_rev1/onig-6.9.5-rev1.tar.gz && \
tar xfz onig-6.9.5-rev1.tar.gz && \
rm onig-6.9.5-rev1.tar.gz && \
cd /tmp/onig-6.9.5 && \
./configure && \
make && \
make install && \
cd / && \
rm -r /tmp/onig-6.9.5
#------------------------------------------------------------------------------
# Create compile scripts
#------------------------------------------------------------------------------
COPY check-if-gopath-available.sh compile-linux.sh compile-windows-amd64.sh /
CMD /check-if-gopath-available.sh && echo "Type 'ls' to see the available compile scripts." && exec /bin/bash