forked from input-output-hk/plutus-pioneer-program
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
160 lines (131 loc) · 5.04 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION} as system_deps
ENV DEBIAN_FRONTEND=nonintercative
RUN mkdir -p /app/src
WORKDIR /app
# system_deps args
ARG IOHK_LIBSODIUM_GIT_REV=66f017f16633f2060db25e17c170c2afa0f2a8a1
ARG IOKH_LIBSECP251_GIT_REV=ac83be33d0956faf6b7f61a60ab524ef7d6a473a
# development dependencies
RUN apt-get update -y && apt-get install -y \
curl \
xz-utils \
automake \
build-essential \
g++\
git \
jq \
libicu-dev \
libffi-dev \
libgmp-dev \
libncursesw5 \
libpq-dev \
libssl-dev \
libsystemd-dev \
libtinfo-dev \
libtool \
make \
pkg-config \
tmux \
wget \
zlib1g-dev libreadline-dev llvm libnuma-dev \
&& rm -rf /var/lib/apt/lists/*
# install secp2561k library with prefix '/'
RUN git clone https://github.com/bitcoin-core/secp256k1 &&\
cd secp256k1 \
&& git fetch --all --tags &&\
git checkout ${IOKH_LIBSECP251_GIT_REV} \
&& ./autogen.sh && \
./configure --prefix=/usr --enable-module-schnorrsig --enable-experimental && \
make && \
make install && cd .. && rm -rf ./secp256k1
# install nix
# RUN curl -L -o install.sh https://nixos.org/nix/install \
# && bash install.sh --daemon
FROM system_deps as haskell
#SHELL ["bash", "-lc"]
# haskell args
ARG CABAL_VERSION=3.6.2.0
ARG GHC_VERSION=8.10.7
ARG HLS_VERSION=1.7.0.0
#RUN nix-env -iA niv -f https://github.com/nmattia/niv/tarball/master --substituters https://niv.cachix.org --trusted-public-keys niv.cachix.org-1:X32PCg2e/zAm3/uD1ScqW2z/K0LtDyNV7RdaxIuLgQM=
# && niv add mlabs-haskell/plutus-simple-model -r 64dd3fee4caff9472e0dcc2e14cc587452c80e77
# install libsodium from sources with prefix '/'
RUN git clone https://github.com/input-output-hk/libsodium.git &&\
cd libsodium \
&& git fetch --all --tags &&\
git checkout ${IOHK_LIBSODIUM_GIT_REV} \
&& ./autogen.sh && \
./configure --prefix=/usr && \
make && \
make install && cd .. && rm -rf ./libsodium
# install ghcup
ENV PATH=${PATH}:${HOME:-/root}/.ghcup/bin
RUN wget --secure-protocol=TLSv1_2 \
https://downloads.haskell.org/~ghcup/$(arch)-linux-ghcup \
&& chmod +x $(arch)-linux-ghcup \
&& mkdir -p ${HOME:-/root}/.ghcup/bin \
&& mv $(arch)-linux-ghcup ${HOME:-/root}/.ghcup/bin/ghcup
RUN ghcup config set downloader Wget \
&& ghcup install ghc ${GHC_VERSION} \
&& ghcup install cabal ${CABAL_VERSION}
RUN ghcup set ghc ${GHC_VERSION}
RUN ghcup install hls ${HLS_VERSION}
ENV PATH=${PATH}:${HOME:-/root}/.cabal/bin
#RUN echo "export PATH=$PATH:/root/.cabal/bin" >> ~/.bashrc
#RUN cabal update
FROM haskell as cardano_node
# install cardano-node binaries
RUN wget https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz \
&& tar -xf cardano-node-1.35.5-linux.tar.gz -C /usr/bin \
&& cardano-cli --version
# node socket
RUN echo "export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket" >> ~/.bashrc
RUN mkdir -p ${HOME:-/root}/node-config
# Download cardano-node config
RUN mkdir -p /ipc
RUN wget https://book.world.dev.cardano.org/environments/preview/config.json \
&& wget https://book.world.dev.cardano.org/environments/preview/db-sync-config.json \
&& wget https://book.world.dev.cardano.org/environments/preview/submit-api-config.json \
&& wget https://book.world.dev.cardano.org/environments/preview/topology.json \
&& wget https://book.world.dev.cardano.org/environments/preview/byron-genesis.json \
&& wget https://book.world.dev.cardano.org/environments/preview/alonzo-genesis.json \
&& wget https://book.world.dev.cardano.org/environments/preview/shelley-genesis.json \
&& mv ./*.json ${HOME:-/root}/node-config/
# start-node alias
RUN echo "alias start-node='cardano-node run \
--config ${HOME:-/root}/node-config/config.json \
--topology ${HOME:-/root}/node-config/topology.json \
--database-path ${HOME:-/root}/preview-db \
--socket-path /ipc/node.socket'" >> ~/.bashrc
FROM cardano_node as kuber
# In case we need to build from source
# install kuber
#RUN git clone https://github.com/dQuadrant/kuber \
# && cd kuber \
# && cabal update \
# && cd server \
# && cabal build \
# && cabal install
# install kuber
RUN wget https://github.com/rober-m/kuber/releases/download/babbage-era/$(arch)-linux-kuber \
&& chmod +x $(arch)-linux-kuber \
&& mv $(arch)-linux-kuber /usr/bin/kuber \
&& echo "export NETWORK=preview" >> ~/.bashrc
FROM kuber as nodejs
ENV NODE_VERSION=16.13.0
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version
FROM nodejs as plutus
RUN git clone https://github.com/input-output-hk/plutus-pioneer-program \
&& cd plutus-pioneer-program/code \
&& cabal update \
&& cabal build all \
&& cabal install stylish-haskell
RUN echo "alias serve-docs='python3 -m http.server -d /workspaces/plutus-pioneer-program/docs/plutus-docs/haddock/'" >> ~/.bashrc