Skip to content

Commit 66889ba

Browse files
author
Christos KK Loverdos
committed
Dockerize Mantis
1 parent 35e0661 commit 66889ba

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

docker/Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM ubuntu:xenial
2+
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
ARG SBT_VERIFY_TAG
6+
ENV SBT_VERIFY_TAG ${SBT_VERIFY_TAG:-v0.4.1}
7+
8+
ARG MANTIS_TAG
9+
ENV MANTIS_TAG ${MANTIS_TAG:-phase/iele_testnet}
10+
11+
ARG MANTIS_DIST_ZIP_NAME
12+
ENV MANTIS_DIST_ZIP_NAME ${MANTIS_DIST_ZIP_NAME:-mantis-*.zip}
13+
14+
# Just install enough to get nix up and running
15+
RUN apt-get update \
16+
&& apt-get install -y curl bzip2 locales \
17+
&& locale-gen en_US.UTF-8 \
18+
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
19+
&& adduser --disabled-password --gecos '' mantis \
20+
&& mkdir /nix \
21+
&& chown mantis:mantis /nix \
22+
&& su mantis -c 'curl https://nixos.org/nix/install | sh && . ~/.nix-profile/etc/profile.d/nix.sh && nix-channel --update && tail -n 1 ~/.profile >> ~/.bashrc' \
23+
&& ln -s /home/mantis/mantis-dist/app /app \
24+
&& apt-get purge -y curl bzip2 \
25+
&& apt-get clean autoremove
26+
27+
USER mantis
28+
WORKDIR /home/mantis
29+
ENV USER mantis
30+
31+
# install java, sbt, git, unzip
32+
RUN . ~/.nix-profile/etc/profile.d/nix.sh \
33+
&& nix-env -i openjdk-8u172b02 sbt-1.1.4 git unzip
34+
35+
# TODO: Could just use a nix-shell and garbage collect (e.g. git, unzip, sbt) after the installations ...
36+
RUN . ~/.nix-profile/etc/profile.d/nix.sh \
37+
&& mkdir repos && cd repos \
38+
&& git clone --branch $SBT_VERIFY_TAG --depth=1 https://github.com/input-output-hk/sbt-verify.git \
39+
&& cd sbt-verify \
40+
&& sbt publishLocal \
41+
&& cd - \
42+
&& git clone --branch $MANTIS_TAG --depth=1 https://github.com/input-output-hk/mantis.git \
43+
&& cd mantis \
44+
&& git submodule update --init \
45+
&& sbt 'set test in Test := {}' dist \
46+
&& mkdir -p ~/mantis-dist/app \
47+
&& unzip -d ~/mantis-dist/app target/universal/$MANTIS_DIST_ZIP_NAME \
48+
&& mv ~/mantis-dist/app/*/* ~/mantis-dist/app \
49+
&& rmdir ~/mantis-dist/app/$MANTIS_DIST_ZIP_NAME \
50+
&& cd ~ \
51+
&& rm -rf ~/repos ~/.ivy2 ~/.sbt
52+
53+
# Now mantis is in /home/mantis/mantis-dist/app
54+
# or just /app

docker/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux
4+
5+
HERE=$(readlink -m $(dirname ${BASH_SOURCE[0]}))
6+
DATE_TAG=$(date --iso-8601)
7+
TAG=${1:-$DATE_TAG}
8+
9+
docker build -t mantis:$TAG $HERE

0 commit comments

Comments
 (0)