Skip to content

Commit 234b561

Browse files
committed
refactored Dockerfile
1 parent ad7a895 commit 234b561

File tree

1 file changed

+41
-30
lines changed

1 file changed

+41
-30
lines changed

.devcontainer/Dockerfile

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
ARG UBUNTU_VERSION=20.04
2-
FROM ubuntu:${UBUNTU_VERSION} as first_stage
2+
FROM ubuntu:${UBUNTU_VERSION} as system_deps
33
ENV DEBIAN_FRONTEND=nonintercative
44
RUN mkdir -p /app/src
55
WORKDIR /app
66

7+
# system_deps args
8+
ARG IOHK_LIBSODIUM_GIT_REV=66f017f16633f2060db25e17c170c2afa0f2a8a1
9+
ARG IOKH_LIBSECP251_GIT_REV=ac83be33d0956faf6b7f61a60ab524ef7d6a473a
10+
11+
# haskell args
12+
ARG CABAL_VERSION=3.6.2.0
13+
ARG GHC_VERSION=8.10.7
14+
ARG HLS_VERSION=1.7.0.0
15+
716
# development dependencies
817
RUN apt-get update -y && apt-get install -y \
918
curl \
@@ -29,12 +38,6 @@ RUN apt-get update -y && apt-get install -y \
2938
zlib1g-dev libreadline-dev llvm libnuma-dev \
3039
&& rm -rf /var/lib/apt/lists/*
3140

32-
ARG CABAL_VERSION=3.6.2.0
33-
ARG GHC_VERSION=8.10.7
34-
ARG HLS_VERSION=1.7.0.0
35-
ARG IOHK_LIBSODIUM_GIT_REV=66f017f16633f2060db25e17c170c2afa0f2a8a1
36-
ARG IOKH_LIBSECP251_GIT_REV=ac83be33d0956faf6b7f61a60ab524ef7d6a473a
37-
3841
# install secp2561k library with prefix '/'
3942
RUN git clone https://github.com/bitcoin-core/secp256k1 &&\
4043
cd secp256k1 \
@@ -45,6 +48,16 @@ RUN git clone https://github.com/bitcoin-core/secp256k1 &&\
4548
make && \
4649
make install && cd .. && rm -rf ./secp256k1
4750

51+
# install nix
52+
# RUN curl -L -o install.sh https://nixos.org/nix/install \
53+
# && bash install.sh --daemon
54+
55+
FROM system_deps as haskell
56+
57+
SHELL ["bash", "-lc"]
58+
59+
#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=
60+
# && niv add mlabs-haskell/plutus-simple-model -r 64dd3fee4caff9472e0dcc2e14cc587452c80e77
4861

4962
# install libsodium from sources with prefix '/'
5063
RUN git clone https://github.com/input-output-hk/libsodium.git &&\
@@ -56,7 +69,6 @@ RUN git clone https://github.com/input-output-hk/libsodium.git &&\
5669
make && \
5770
make install && cd .. && rm -rf ./libsodium
5871

59-
6072
# install ghcup
6173
ENV PATH=${PATH}:${HOME:-/root}/.ghcup/bin
6274
RUN wget --secure-protocol=TLSv1_2 \
@@ -67,36 +79,26 @@ RUN wget --secure-protocol=TLSv1_2 \
6779

6880
RUN ghcup config set downloader Wget \
6981
&& ghcup install ghc ${GHC_VERSION} \
70-
&& ghcup install cabal ${CABAL_VERSION} \
71-
&& ghcup set ghc ${GHC_VERSION}
82+
&& ghcup install cabal ${CABAL_VERSION}
83+
RUN ghcup set ghc ${GHC_VERSION}
7284
RUN ghcup install hls ${HLS_VERSION}
7385

74-
# install nix and niv
75-
RUN curl -L -o install.sh https://nixos.org/nix/install \
76-
&& bash install.sh --daemon
77-
78-
FROM first_stage as second_stage
79-
SHELL ["bash", "-lc"]
80-
#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=
81-
# && niv add mlabs-haskell/plutus-simple-model -r 64dd3fee4caff9472e0dcc2e14cc587452c80e77
86+
ENV PATH=${PATH}:${HOME:-/root}/.cabal/bin
87+
#RUN echo "export PATH=$PATH:/root/.cabal/bin" >> ~/.bashrc
88+
RUN cabal update
89+
90+
FROM haskell as cardano_node
8291

8392
# install cardano-node binaries
8493
RUN wget https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz \
8594
&& tar -xf cardano-node-1.35.5-linux.tar.gz -C /usr/bin \
8695
&& cardano-cli --version
8796

97+
# node socket
8898
RUN echo "export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket" >> ~/.bashrc
89-
90-
# install kuber
91-
RUN git clone https://github.com/dQuadrant/kuber \
92-
&& cd kuber \
93-
&& cabal update \
94-
&& cd server \
95-
&& cabal install
96-
97-
RUN echo "export PATH=$PATH:/root/.cabal/bin" >> ~/.bashrc
98-
9999
RUN mkdir -p ${HOME:-/root}/node-config
100+
101+
# Download cardano-node config
100102
RUN mkdir -p /ipc
101103

102104
RUN wget https://book.world.dev.cardano.org/environments/preview/config.json \
@@ -108,11 +110,20 @@ RUN wget https://book.world.dev.cardano.org/environments/preview/config.json \
108110
&& wget https://book.world.dev.cardano.org/environments/preview/shelley-genesis.json \
109111
&& mv ./*.json ${HOME:-/root}/node-config/
110112

111-
ARG CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
112-
113+
# start-node alias
113114
RUN echo "alias start-node='cardano-node run \
114115
--config ${HOME:-/root}/node-config/config.json \
115116
--topology ${HOME:-/root}/node-config/topology.json \
116117
--database-path ${HOME:-/root}/preview-db \
117118
--socket-path /ipc/node.socket'" >> ~/.bashrc
118119

120+
FROM cardano_node as kuber
121+
122+
# install kuber
123+
RUN git clone https://github.com/dQuadrant/kuber \
124+
&& cd kuber \
125+
&& cabal update \
126+
&& cd server \
127+
&& cabal build \
128+
&& cabal install
129+

0 commit comments

Comments
 (0)