diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..e660fd93d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +bin/ diff --git a/Dockerfile b/Dockerfile index 04fddba9d..ab0881f79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,48 @@ -FROM ocamlpro/ocaml:4.14 +FROM quay.io/pypa/manylinux_2_28_aarch64 AS compilation -USER ocaml +ADD https://github.com/ocaml/opam/releases/download/2.2.0-beta1/opam-2.2.0-beta1-arm64-linux /bin/opam -RUN sudo apk add zlib-static +RUN chmod +x /bin/opam -COPY . . +RUN opam init -a --bare --disable-sandboxing -RUN sudo chmod a+wx . +COPY . /src/alt-ergo -RUN opam switch create . ocaml-system --locked --deps-only --ignore-constraints-on alt-ergo-lib,alt-ergo-parsers +WORKDIR /src/alt-ergo + +ENV OPAMYES 1 +ENV OPAMDEPEXTYES 1 +ENV OPAMCONFIRMLEVEL unsafe-yes +ENV OPAMERRLOGLEN 0 + +RUN yum -y install gmp-static zlib-static + +RUN opam switch create . 4.14.1 --locked --deps-only --ignore-constraints-on alt-ergo-lib,alt-ergo-parsers RUN opam exec -- dune subst -RUN LINK_MODE=static opam exec -- dune build --release src/bin/text/Main_text.exe +RUN LINK_MODE=mixed opam exec -- dune build --release src/bin/text/Main_text.exe + +FROM scratch AS alt-ergo +COPY --from=compilation /src/alt-ergo/src/bin/text/Main_text.exe /bin/alt-ergo +ENTRYPOINT [ "/bin/alt-ergo" ] + +# FROM ocamlpro/ocaml:4.14 AS compilation +# +# USER ocaml +# +# RUN sudo apk add zlib-static +# +# COPY --chown=ocaml:ocaml . /src/alt-ergo +# +# WORKDIR /src/alt-ergo +# +# RUN opam switch create . ocaml-system --locked --deps-only --ignore-constraints-on alt-ergo-lib,alt-ergo-parsers +# +# RUN opam exec -- dune subst +# +# RUN LINK_MODE=static opam exec -- dune build --release src/bin/text/Main_text.exe +# +# FROM scratch AS alt-ergo +# COPY --from=compilation /src/alt-ergo/src/bin/text/Main_text.exe /bin/alt-ergo +# ENTRYPOINT [ "/bin/alt-ergo" ] diff --git a/src/bin/text/gen-link-flags.sh b/src/bin/text/gen-link-flags.sh index 1e23263fd..340818d88 100755 --- a/src/bin/text/gen-link-flags.sh +++ b/src/bin/text/gen-link-flags.sh @@ -26,7 +26,8 @@ case "$LINK_MODE" in linux) for lib in $LIBS; do CCLIB="$CCLIB -l$lib" - done;; + done + CCLIB="-Wl,-Bstatic $CCLIB -Wl,-Bdynamic";; macosx) for lib in $LIBS; do if [[ $lib == lib* ]]; then