forked from Consensys/constellation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-ubuntu.dockerfile
54 lines (42 loc) · 2.06 KB
/
build-ubuntu.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
# DISTRO_VERSION can be something like "trusty", "xenial", or "zesty".
# Supply this using e.g.: --build-arg DISTRO_VERSION=trusty
ARG DISTRO_VERSION
FROM ubuntu:${DISTRO_VERSION}
RUN apt-get update
RUN apt-get install -y curl && \
curl -sSL https://get.haskellstack.org/ | sh
# We need a PPA for libsodium on trusty:
RUN bash -c 'if [ "$(lsb_release -sc)" == "trusty" ]; then \
apt-get install -y software-properties-common && \
add-apt-repository ppa:chris-lea/libsodium && \
apt-get update; \
fi'
RUN apt-get install -y libgmp-dev libdb-dev libleveldb-dev libsodium-dev zlib1g-dev libtinfo-dev && \
apt-get install -y ruby ruby-dev build-essential && \
gem install --no-ri --no-rdoc fpm
# CONSTELLATION BUILD. If you modify this, change the other dockerfiles too.
ENV SRC /usr/local/src/constellation
WORKDIR $SRC
ADD stack.yaml $SRC/
RUN stack setup
ADD LICENSE constellation.cabal $SRC/
RUN stack build --dependencies-only
# TODO: possibly combine these commands with tar+ADD
ADD README.md CHANGELOG.md Setup.hs $SRC/
COPY bin/ $SRC/bin/
COPY test/ $SRC/test/
COPY Constellation/ $SRC/Constellation/
RUN stack install --local-bin-path /usr/local/bin --test
# END constellation build.
ARG DISTRO_VERSION
RUN fpm -t deb --deb-changelog CHANGELOG.md -d libgmp-dev -d libdb-dev -d libleveldb-dev -d libsodium-dev -d zlib1g-dev -d libtinfo-dev \
-s dir \
-n constellation \
-p ubuntu-${DISTRO_VERSION}.deb \
-v "$(cat constellation.cabal | grep '^version:' | awk '{print $2}')" \
--description "$(cat constellation.cabal | grep '^description:' | sed 's/description: *//')" \
--url "https://github.com/jpmorganchase/constellation" \
--maintainer "$(cat constellation.cabal | grep 'author:' | sed 's/author: *//')" \
--license "$(cat constellation.cabal | grep license: | sed 's/license: *//')" \
--vendor "JPMorgan Chase & Co." \
$(cat constellation.cabal | grep '^executable ' | awk '{print $2}' | sed 's#.*#/usr/local/bin/&=/usr/local/bin/&#')