-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
133 lines (112 loc) · 4.27 KB
/
Dockerfile
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
FROM debian:bullseye-slim as build
ENV LANG C.UTF-8
RUN apt-get update && \
apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
chrony \
curl \
g++ \
git \
gnupg2 \
jq \
libffi-dev \
libgmp-dev \
liblzma-dev \
libncursesw5 \
libnuma-dev \
libpq-dev \
libssl-dev \
libsystemd-dev \
libtinfo-dev \
libtool \
lsb-release \
make \
pkg-config \
procps \
snapd \
software-properties-common \
tmux \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*
# yq:
RUN curl https://github.com/mikefarah/yq/releases/download/v4.6.1/yq_linux_amd64 > /usr/local/bin/yq && chmod +x /usr/local/bin/yq
# Libsodium:
RUN git clone https://github.com/input-output-hk/libsodium && \
cd libsodium && \
git checkout dbb48cc && \
./autogen.sh && \
./configure && \
make && \
make install
# Libsecp256k1:
RUN git clone https://github.com/bitcoin-core/secp256k1 && \
cd secp256k1 && \
git checkout ac83be33d0956faf6b7f61a60ab524ef7d6a473a && \
./autogen.sh && \
./configure --prefix=/usr/local --enable-module-schnorrsig --enable-experimental && \
make && \
make install
ARG BLST_VERSION=v0.3.11
ENV BLST_VERSION=${BLST_VERSION}
RUN git clone --depth 1 --branch ${BLST_VERSION} https://github.com/supranational/blst && \
cd blst && \
./build.sh && \
printf 'prefix=/usr/local\nexec_prefix=${prefix}\nlibdir=${exec_prefix}/lib\nincludedir=${prefix}/include\nName: libblst\nDescription: Multilingual BLS12-381 signature library\nURL: https://github.com/supranational/blst\nVersion: '${BLST_VERSION#v}'\nCflags: -I${includedir}\nLibs: -L${libdir} -lblst\n' > libblst.pc && \
cp libblst.pc /usr/local/lib/pkgconfig/ && \
cp bindings/blst_aux.h bindings/blst.h bindings/blst.hpp /usr/local/include/ && \
cp libblst.a /usr/local/lib && \
chmod 644 /usr/local/lib/libblst.a && \
chmod 644 /usr/local/lib/pkgconfig/libblst.pc && \
chmod 644 /usr/local/include/blst.h && \
chmod 644 /usr/local/include/blst.hpp && \
chmod 644 /usr/local/include/blst_aux.h
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
# Install gpg keys (https://www.haskell.org/ghcup/install/):
RUN gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 7D1E8AFD1D4A16D71FADA2F2CCC85C0E40C06A8C && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys FE5AB6C91FEA597C3B31180B73EDE9E8CFBAEF01 && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys EAF2A9A722C0C96F2B431CA511AAD8CEDEE0CAEF
# ghcup:
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=1
ENV BOOTSTRAP_HASKELL_GHC_VERSION=9.6.5
ENV BOOTSTRAP_HASKELL_CABAL_VERSION=3.12.1.0
RUN bash -c "curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh"
ENV PATH=${PATH}:/root/.local/bin
ENV PATH=${PATH}:/root/.ghcup/bin
# ==================================[ BUILD ]========================================
WORKDIR /DEX
# TODO: first build only dependencies
COPY . .
# TODO: Fix revision information [Broken revision information in the bot backend #28]
RUN git init && \
git config --global user.email "[email protected]" && \
git config --global user.name "CI" && \
git add . && \
git commit -m "Dummy commit"
RUN cabal update
RUN cabal build all --enable-tests --enable-benchmarks
RUN cp $(cabal list-bin geniusyield-server) /DEX/geniusyield-server
# =============================[ SERVER ]================================
FROM debian:bullseye-slim
ENV LANG C.UTF-8
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgmp10 \
libpq5 \
libssl1.1 \
libsystemd0 \
libtinfo6 \
procps && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /usr/local/lib /usr/local/lib
COPY --from=build /usr/local/bin/yq /usr/local/bin/yq
COPY --from=build /DEX/start.sh /DEX/start.sh
COPY --from=build /DEX/geniusyield-server /usr/local/bin/geniusyield-server
COPY --from=build /DEX/web /DEX/web
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
WORKDIR /DEX
LABEL org.opencontainers.image.source="https://github.com/geniusyield/dex-contracts-api"
ENTRYPOINT ["/bin/bash", "./start.sh"]