-
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.
- Loading branch information
Showing
2 changed files
with
29 additions
and
34 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,37 +1,30 @@ | ||
FROM ocaml/opam:alpine-3.3_ocaml-4.03.0 as builder | ||
FROM alpine:3.20 AS builder | ||
|
||
RUN sudo apk add m4 expect make binutils gcc | ||
RUN opam depext conf-m4.1 | ||
RUN opam install "core_kernel>=v0.9.0" "ocamlfind>=1.7.3" ppx_deriving "menhir>=20170607" | ||
RUN apk update && apk add bash opam m4 expect make binutils gcc musl-dev shadow | ||
|
||
RUN sudo mkdir -m a=rwx /silly-ml | ||
RUN useradd -m opam | ||
WORKDIR /silly-ml | ||
COPY Makefile . | ||
COPY _tags . | ||
COPY myocamlbuild.ml . | ||
COPY repl.expect . | ||
COPY *.sh ./ | ||
RUN chown opam:opam /silly-ml | ||
USER opam | ||
|
||
RUN opam init --bare --no-setup --disable-sandboxing | ||
RUN opam switch create 4.03.0 | ||
|
||
RUN opam install --yes "core_kernel>=v0.9.0" "ocamlfind>=1.7.3" ppx_deriving "menhir>=20170607" | ||
|
||
COPY Makefile _tags myocamlbuild.ml . | ||
COPY src src | ||
RUN sudo mkdir -m a=rwx examples | ||
ADD examples/*.silly-ml examples/ | ||
ADD examples/*.exit-code examples/ | ||
|
||
RUN sudo mkdir -m a=rwx runtime | ||
ADD runtime/include runtime/include/ | ||
ADD runtime/*.asm runtime/ | ||
ADD runtime/*.c runtime/ | ||
ADD runtime/*.h runtime/ | ||
ADD runtime/*.sh runtime/ | ||
ADD runtime/*.expected runtime/ | ||
ADD runtime/*.env runtime/ | ||
ADD runtime/Makefile runtime/ | ||
|
||
RUN eval `opam config env` && make test | ||
|
||
FROM alpine:3.3 | ||
COPY --chown=opam runtime runtime | ||
|
||
RUN opam exec make | ||
|
||
COPY repl.expect *.sh . | ||
COPY --chown=opam examples examples | ||
|
||
RUN opam exec make test | ||
|
||
FROM alpine:3.20 | ||
RUN apk update && apk add binutils | ||
WORKDIR /root/ | ||
COPY --from=builder /silly-ml/repl.native . | ||
COPY --from=builder /silly-ml/compiler.native . | ||
COPY --from=builder /silly-ml/runtime/libruntime.a . | ||
CMD ["./repl.native"] | ||
WORKDIR /silly-ml | ||
COPY --from=builder /silly-ml/*.native /silly-ml/runtime/libruntime.a . | ||
CMD ["/silly-ml/repl.native"] |
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