-
Notifications
You must be signed in to change notification settings - Fork 568
/
Copy path2-opam-deps
52 lines (43 loc) · 1.89 KB
/
2-opam-deps
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
#################################################################################################
# The "opam-deps" Stage
# - Continues from the build-deps image
# - Installs all opam dependencies and pins from mina's github
# - Includes the entire mina codebase and submodules in "${MINA_DIR}" (must be writable by opam user)
# - Largely mirrors/replaces ./scripts/setup-opam.sh
#################################################################################################
FROM build-deps AS opam-deps
# location of repo used for pins and external package commits
ARG MINA_DIR=mina
# branch to checkout for opam dependencies
ARG MINA_BRANCH=compatible
# mina repository to pull from
ARG MINA_REPO=https://github.com/MinaProtocol/mina
# location of external packages
ARG EXTERNAL_PKG_DIR=$MINA_DIR/src/external
# don't keep build directories
# to force reinstall of pinned packages from Mina sources
# and to keep Docker image reasonable size
ENV OPAMKEEPBUILDDIR false
ENV OPAMREUSEBUILDDIR false
# Limit logs for opam install errors to 20 lines per error
ENV OPAMERRLOGLEN 20
ENV GIT_LFS_SKIP_SMUDGE 1
# --- Shallow clone the Mina repo, only focused on the given MINA_BRANCH
# git will clone into an empty dir, but this also helps us set the workdir in advance
RUN git clone \
-b "${MINA_BRANCH}" \
--depth 1 \
--shallow-submodules \
--recurse-submodules \
${MINA_REPO} ${HOME}/${MINA_DIR}
WORKDIR $HOME/$MINA_DIR
ENV OPAMYES 1
# --- Import Opam Switch
# TODO: handle this opam work without cloning the full repository (directly pull opam.export)
RUN opam switch import opam.export --quiet
# --- Pin external packages / submodules
# TODO: Would be really nice to pull this script, the git submodules, and opam.export exclusively in this stage
# Remove .ppx and the .ppx-cache so they can be built on each run
RUN eval $(opam config env) \
&& scripts/pin-external-packages.sh \
&& opam clean --logs -cs --quiet