-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile_Golang
62 lines (51 loc) · 1.73 KB
/
Dockerfile_Golang
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
FROM ubuntu:16.04
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
pkg-config \
swig \
doxygen \
curl \
ca-certificates \
git \
wget \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# install cmake
ENV CMAKE_VERSION 3.10.2
RUN wget https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}.tar.gz \
&& tar xvfz cmake-${CMAKE_VERSION}.tar.gz \
&& cd cmake-${CMAKE_VERSION} \
&& ./bootstrap \
&& make -j4 \
&& make install \
&& cd - \
&& rm -rf ./cmake-*
# install golang
ENV GOLANG_VERSION 1.12.10
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 aaa84147433aed24e70b31da369bb6ca2859464a45de47c2a5023d8573412f6b
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
# build virgil-crypto-go
ADD . virgil-crypto
RUN cd virgil-crypto \
&& cmake -H. -B_build -DCMAKE_INSTALL_PREFIX=_install -DLANG=go -DINSTALL_CORE_LIBS=ON -DVIRGIL_CRYPTO_FEATURE_PYTHIA=ON \
&& cmake --build _build --target install
# v4
RUN go get -d gopkg.in/virgilsecurity/virgil-crypto-go.v4 \
&& cp -r virgil-crypto/_install/* $GOPATH/src/gopkg.in/virgilsecurity/virgil-crypto-go.v4
# v5
RUN go get -d gopkg.in/virgilsecurity/virgil-crypto-go.v5 \
&& cp -r virgil-crypto/_install/* $GOPATH/src/gopkg.in/virgilsecurity/virgil-crypto-go.v5
# cleanup
RUN rm -rf virgil-crypto