-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first pass at supporting armhf (and other architectures)
Signed-off-by: Tim Dysinger <tim@dysinger.net>
- Loading branch information
Showing
1 changed file
with
77 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,79 @@ | ||
# TODO: switch to smaller image? | ||
FROM ocaml/opam2:alpine-3.8-ocaml-4.07 as base | ||
|
||
RUN sudo apk update | ||
# perl-utils needed for 'shasum' | ||
RUN sudo apk add m4 perl perl-utils | ||
RUN sudo apk add libressl-dev libffi-dev | ||
RUN sh -c "cd ~/opam-repository && git pull -q" | ||
RUN opam update | ||
# esy deps | ||
RUN opam install dune reason lwt_ppx ppx_let ppx_deriving_yojson cmdliner bos logs \ | ||
re angstrom opam-format ppx_inline_test ppx_sexp_conv opam-state ppx_expect cudf dose3 | ||
|
||
ENV ESY_VERSION=v0.3.4 | ||
RUN git clone -b $ESY_VERSION https://github.com/esy/esy.git | ||
RUN sh -c 'eval `opam config env` cd /home/opam/opam-repository/esy && dune build -j 4' | ||
|
||
ENV ESY_SOLVE_CUDF_VERSION=v0.1.8 | ||
|
||
RUN git clone -b $ESY_SOLVE_CUDF_VERSION https://github.com/andreypopp/esy-solve-cudf.git /home/opam/opam-repository/esy-solve-cudf | ||
# esy-solve-cudf deps | ||
RUN opam install mccs | ||
RUN sh -c 'eval `opam config env` cd /home/opam/opam-repository/esy-solve-cudf && dune build -j 4' | ||
|
||
RUN git clone https://github.com/esy-ocaml/FastReplaceString.git /home/opam/opam-repository/fastreplacestring | ||
RUN cd /home/opam/opam-repository/fastreplacestring && make | ||
RUN cp /home/opam/opam-repository/fastreplacestring/bin/fastreplacestring /home/opam/opam-repository/esy/bin/fastreplacestring | ||
|
||
RUN mkdir -p /home/opam/opam-repository/esy/_build/default/node_modules/esy-solve-cudf/ | ||
RUN cp /home/opam/opam-repository/esy-solve-cudf/_build/default/bin/esySolveCudfCommand.exe /home/opam/opam-repository/esy/_build/default/node_modules/esy-solve-cudf/esySolveCudfCommand.exe | ||
|
||
RUN sudo ln -s /home/opam/opam-repository/esy/_build/default/esy/bin/esyCommand.exe /bin/esy | ||
# -*- mode: dockerfile; -*- | ||
############################################################################### | ||
# 1ST REGISTER THE MULTIARCH/QEMU-USER-STATIC IMAGE | ||
# docker run --rm --privileged multiarch/qemu-user-static:register \ | ||
# --reset --credential yes | ||
############################################################################### | ||
# THEN PASS AN ARGUMENT TO 'docker build' TO DETERMINE THE TARGET ARCHITECTURE | ||
# docker build --build-arg IMAGE=multiarch/debian-debootstrap:armhf-stretch | ||
# docker build --build-arg IMAGE=multiarch/debian-debootstrap:arm64-stretch | ||
# THE DEFAULT FROM IMAGE WILL BE 64BIT INTEL/AMD | ||
############################################################################### | ||
ARG IMAGE=multiarch/debian-debootstrap:amd64-stretch | ||
FROM ${IMAGE} | ||
############################################################################### | ||
# UPGRADE AND ADD A NON-ROOT USER (OPAM LATER COMPLAINS IF YOU DO NOT) | ||
RUN perl -p -i -e 's/main/main restricted universe/g' /etc/apt/sources.list | ||
RUN apt-get update | ||
RUN apt-get upgrade -y | ||
RUN apt-get dist-upgrade -y | ||
RUN apt-get install -y apt-transport-https curl gnupg sudo | ||
RUN update-ca-certificates | ||
RUN useradd -m -s /bin/bash -G sudo opam | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD: ALL' | tee -a /etc/sudoers.d/nopasswd | ||
############################################################################### | ||
# BECOME 'opam' INSTEAD OF 'root' | ||
WORKDIR /home/opam | ||
CMD /bin/bash -l | ||
USER opam | ||
############################################################################### | ||
# OPAM/OCAML INSTALL | ||
RUN sudo apt-get install -y bzip2 g++ git make m4 pkg-config rsync \ | ||
unzip xz-utils | ||
RUN curl -sL https://raw.githubusercontent.com/ocaml/opam/2.0.3/shell/install.sh \ | ||
| sed 's/read BINDIR/BINDIR=\/usr\/local\/bin/g' \ | ||
| sh | ||
RUN opam init --compiler=4.07.1 --auto-setup --disable-sandboxing | ||
RUN eval $(opam env) && opam install opam-depext dune | ||
############################################################################### | ||
# OPAM INIT | ||
ENV OPAMYES 1 | ||
RUN opam init --auto-setup --disable-sandboxing | ||
WORKDIR /home/opam | ||
############################################################################### | ||
# ESY | ||
RUN sudo apt-get install -y libssl-dev libffi-dev | ||
RUN eval $(opam env) && opam pin cmdliner --no-action \ | ||
https://github.com/esy-ocaml/cmdliner.git#8500634a | ||
RUN eval $(opam env) && opam pin angstrom --no-action \ | ||
https://github.com/esy-ocaml/angstrom.git#5a06a0 | ||
RUN eval $(opam env) && opam install angstrom bos cmdliner cudf dose3 \ | ||
dune logs lwt_ppx opam-format opam-state ppx_deriving_yojson \ | ||
ppx_expect ppx_inline_test ppx_let ppx_sexp_conv re reason | ||
ARG ESY=master | ||
RUN git clone -b ${ESY} --recurse-submodules \ | ||
https://github.com/esy/esy.git /tmp/esy | ||
WORKDIR /tmp/esy | ||
RUN eval $(opam env) \ | ||
&& dune build -j $(nproc --all) --profile release @install \ | ||
&& dune install | ||
ARG ESY_SOLVE_CUDF=master | ||
RUN git clone -b ${ESY_SOLVE_CUDF} --recurse-submodules \ | ||
https://github.com/andreypopp/esy-solve-cudf.git /tmp/esy-solve-cudf | ||
WORKDIR /tmp/esy-solve-cudf | ||
RUN opam pin mccs ./mccs ;# mcss is pinned by git submodule | ||
RUN eval $(opam env) \ | ||
&& dune build -j $(nproc --all) --profile release @install \ | ||
&& dune install | ||
############################################################################### | ||
# DOCKER CONFIG | ||
RUN sudo mkdir /data && sudo chown -R opam:nogroup /data | ||
WORKDIR /data | ||
ENTRYPOINT ["esy"] | ||
ENTRYPOINT /home/opam/opam-repository/esy/_build/default/bin/esy.exe | ||
############################################################################### | ||
# CLEANUP (ONLY USEFUL WITH `docker build --squash`) | ||
RUN apt-get dist-upgrade -y | ||
RUN apt-get autoremove -y | ||
RUN apt-get clean | ||
RUN sudo rm -rf /tmp/* | ||
############################################################################### |