|
| 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 |
0 commit comments