Skip to content

Commit

Permalink
Reduce docker size: better opam cleaning
Browse files Browse the repository at this point in the history
combine the cleaning layer with the building and remove cmt/cmti files

removes about 240MB for base switch
  • Loading branch information
SkySkimmer committed Jan 8, 2024
1 parent 66c39ce commit 3d79f44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 3 additions & 4 deletions dev/ci/docker/edge_ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ RUN opam init -a --disable-sandboxing --bare && eval $(opam env) && opam update
opam switch create "${COMPILER}+flambda" \
--repositories default,ocaml-beta=git+https://github.com/ocaml/ocaml-beta-repository.git \
--packages="ocaml-variants.${COMPILER}+options,ocaml-option-flambda" && eval $(opam env) && \
opam install $BASE_OPAM $BASE_OPAM_EDGE $COQIDE_OPAM_EDGE $CI_OPAM $CI_OPAM_EDGE


RUN opam clean -a -c
opam install $BASE_OPAM $BASE_OPAM_EDGE $COQIDE_OPAM_EDGE $CI_OPAM $CI_OPAM_EDGE && \
opam clean -a -c && \
find ~ '(' -name '*.cmt' -o -name '*.cmti' ')' -delete

# set the locale for the benefit of Python
ENV LANG C.UTF-8
10 changes: 6 additions & 4 deletions dev/ci/docker/old_ubuntu_lts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ ENV COQIDE_OPAM="cairo2.0.6.1 lablgtk3-sourceview3.3.1.2"

# base switch
RUN opam init -a --disable-sandboxing --compiler="$COMPILER" default https://opam.ocaml.org && eval $(opam env) && opam update && \
opam install $BASE_OPAM $COQIDE_OPAM $CI_OPAM $BASE_ONLY_OPAM
opam install $BASE_OPAM $COQIDE_OPAM $CI_OPAM $BASE_ONLY_OPAM && \
opam clean -a -c && \
find ~ '(' -name '*.cmt' -o -name '*.cmti' ')' -delete

# base+32bit switch, note the zarith hack
RUN opam switch create "${COMPILER}+32bit" && eval $(opam env) && \
i386 env CC='gcc -m32' opam install zarith.1.11 && \
opam install $BASE_OPAM

RUN opam clean -a -c
opam install $BASE_OPAM && \
opam clean -a -c && \
find ~ '(' -name '*.cmt' -o -name '*.cmti' ')' -delete

# set the locale for the benefit of Python
ENV LANG C.UTF-8

0 comments on commit 3d79f44

Please sign in to comment.