Skip to content

Commit 630d284

Browse files
author
Christos KK Loverdos
committed
[CGKIELE-166] Add docs, decrease image size
1 parent 0e55883 commit 630d284

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

docker/Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,20 @@ ENV SBT_VERIFY_TAG ${SBT_VERIFY_TAG:-v0.4.1}
88
ARG MANTIS_TAG
99
ENV MANTIS_TAG ${MANTIS_TAG:-phase/iele_testnet}
1010

11+
# The command `sbt dist` generates a zip file in the `target/universal` directory.
12+
# The value of `MANTIS_DIST_ZIP_NAME` must be the name of the generated zip,
13+
# excluding the extension.
14+
# So, for example, currently (commit `35e06611`) the `sbt dist` command
15+
# produces `target/universal/mantis-1.0-daedalus-rc1.zip`, so we can set
16+
# `MANTIS_DIST_ZIP_NAME` to be `mantis-1.0-daedalus-rc1`.
17+
# A glob like `mantis-*` also works and is more convenient, since it is invariant
18+
# with respect to the other part, which dependens on the software version.
1119
ARG MANTIS_DIST_ZIP_NAME
12-
ENV MANTIS_DIST_ZIP_NAME ${MANTIS_DIST_ZIP_NAME:-mantis-*.zip}
20+
ENV MANTIS_DIST_ZIP_NAME ${MANTIS_DIST_ZIP_NAME:-mantis-*}
1321

1422
# Just install enough to get nix up and running
1523
RUN apt-get update \
24+
&& apt-get dist-upgrade -y \
1625
&& apt-get install -y curl bzip2 locales \
1726
&& locale-gen en_US.UTF-8 \
1827
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
@@ -22,15 +31,17 @@ RUN apt-get update \
2231
&& 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' \
2332
&& ln -s /home/mantis/mantis-dist/app /app \
2433
&& apt-get purge -y curl bzip2 \
25-
&& apt-get clean autoremove
34+
&& apt-get clean -y \
35+
&& rm -rf /var/cache/debconf/* /var/lib/apt/lists/* /var/log/* /tmp/* /var/tmp/*
2636

2737
USER mantis
2838
WORKDIR /home/mantis
2939
ENV USER mantis
3040

3141
# install java, sbt, git, unzip
3242
RUN . ~/.nix-profile/etc/profile.d/nix.sh \
33-
&& nix-env -i openjdk-8u172b02 sbt-1.1.4 git unzip
43+
&& nix-env -i openjdk-8u172b02 sbt-1.1.4 git unzip \
44+
&& nix-collect-garbage
3445

3546
# TODO: Could just use a nix-shell and garbage collect (e.g. git, unzip, sbt) after the installations ...
3647
RUN . ~/.nix-profile/etc/profile.d/nix.sh \
@@ -44,7 +55,7 @@ RUN . ~/.nix-profile/etc/profile.d/nix.sh \
4455
&& git submodule update --init \
4556
&& sbt 'set test in Test := {}' dist \
4657
&& mkdir -p ~/mantis-dist/app \
47-
&& unzip -d ~/mantis-dist/app target/universal/$MANTIS_DIST_ZIP_NAME \
58+
&& unzip -d ~/mantis-dist/app target/universal/${MANTIS_DIST_ZIP_NAME}.zip \
4859
&& mv ~/mantis-dist/app/*/* ~/mantis-dist/app \
4960
&& rmdir ~/mantis-dist/app/$MANTIS_DIST_ZIP_NAME \
5061
&& cd ~ \

0 commit comments

Comments
 (0)