Created
January 23, 2020 21:24
-
-
Save naartjie/fa7a0b2f1eb998dcfebae38891ae118a to your computer and use it in GitHub Desktop.
25Mb ocaml-graphql-server docker image
This file contains hidden or 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
| FROM ocaml/opam2:alpine-3.10-ocaml-4.09 as builder | |
| WORKDIR /build | |
| RUN sudo apk update && sudo apk add m4 pkgconfig libressl-dev | |
| RUN opam install \ | |
| bos \ | |
| cohttp \ | |
| crunch \ | |
| astring \ | |
| base64 \ | |
| ocplib-endian \ | |
| digestif \ | |
| cohttp-lwt-unix \ | |
| lwt_ssl \ | |
| graphql-lwt \ | |
| ppx_deriving_yojson \ | |
| graphql-cohttp \ | |
| checkseum \ | |
| ezxmlm \ | |
| ppx_inline_test \ | |
| toml | |
| COPY . . | |
| RUN sudo chown -R opam /build | |
| RUN echo "(lang dune 1.11)" > dune-workspace | |
| RUN echo "(env (_ (flags -cclib -static)))" >> dune-workspace | |
| RUN opam exec -- dune build bin/server.exe | |
| RUN cp ./_build/default/bin/server.exe server.exe | |
| # final image without build cruft | |
| FROM scratch | |
| COPY --from=builder /etc/services /etc/services | |
| COPY --from=builder /etc/ssl/cert.pem /etc/ssl/cert.pem | |
| WORKDIR /app | |
| COPY --from=builder /build/server.exe . | |
| COPY .credentials.toml . | |
| CMD ["./server.exe"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment