Skip to content

Instantly share code, notes, and snippets.

@EduardoRFS
Last active April 4, 2020 08:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EduardoRFS/4d30ef02edefc7e6c97892300bef05a2 to your computer and use it in GitHub Desktop.
Save EduardoRFS/4d30ef02edefc7e6c97892300bef05a2 to your computer and use it in GitHub Desktop.
FROM agners/archlinuxarm-arm32v7
# pacman -Sy --noconfirm base-devel awk m4 git unzip perl wget ocaml opam ocaml-compiler-libs
RUN pacman -Sy --noconfirm base-devel awk m4 git unzip perl wget
RUN curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh | sh
RUN useradd -m esy-user
USER esy-user
ENV OPAMYES=true
RUN opam init --disable-sandboxing
RUN opam pin cmdliner https://github.com/esy-ocaml/cmdliner.git
RUN export PATH=/bin/core_perl:$PATH; \
opam install dune reason lwt_ppx ppx_let ppx_deriving_yojson bos logs \
re angstrom opam-format ppx_inline_test ppx_sexp_conv opam-state ppx_expect cudf dose3
RUN mkdir ~/bootstrap
WORKDIR /home/esy-user/bootstrap
# https://github.com/esy/esy/pull/1000
RUN git clone --single-branch --branch stream-based-copy-file https://github.com/ulrikstrid/esy.git
WORKDIR /home/esy-user/bootstrap/esy
RUN eval $(opam env); \
dune build --profile=release; exit 0
WORKDIR /home/esy-user/bootstrap
RUN git clone https://github.com/andreypopp/esy-solve-cudf.git
RUN opam install mccs
WORKDIR /home/esy-user/bootstrap/esy-solve-cudf
RUN eval $(opam env); \
dune build --profile=release
RUN mkdir -p ../esy/_build/default/node_modules/esy-solve-cudf/
RUN cp _build/default/bin/esySolveCudfCommand.exe ../esy/_build/default/node_modules/esy-solve-cudf/esySolveCudfCommand.exe
RUN ln -s /home/esy-user/bootstrap/esy/_build/default/bin/esy.exe ~/.opam/default/bin/esy
WORKDIR /home/esy-user
# https://github.com/esy/esy/pull/1000
RUN git clone --single-branch --branch stream-based-copy-file https://github.com/ulrikstrid/esy.git
WORKDIR /home/esy-user/esy
# https://github.com/esy/esy/pull/1001
RUN rm -rf esy.lock
# for some reason esy can't find the current path even if I use export on the same step
USER root
RUN ln -s /usr/bin/core_perl/* /bin
USER esy-user
RUN eval $(opam env); \
export PATH=/bin/core_perl:$PATH; \
esy;
USER root
RUN pacman -Sy --noconfirm nodejs npm yarn
USER esy-user
RUN yarn
RUN eval $(opam env); \
esy release:platform-release; \
node scripts/create-release-package-json.js > _platformrelease/package.json; \
cp ~/bootstrap/esy-solve-cudf/_build/default/bin/esySolveCudfCommand.exe ~/esy/node_modules/esy-solve-cudf/esySolveCudfCommand.exe; \
ln -s /home/esy-user/esy/_platformrelease/_build/default/bin/esy.exe /home/esy-user/.yarn/bin/esy; \
echo 'export PATH="$PATH:$(yarn global bin)"' >> ~/.bashrc
# esy should be running now
CMD bash -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment