aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile30
1 files changed, 15 insertions, 15 deletions
diff --git a/Dockerfile b/Dockerfile
index 93d745d..130cb27 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,22 +1,22 @@
-FROM ocaml/opam:alpine as build
+FROM nixos/nix:latest AS builder
# Install system dependencies
-RUN sudo apk add --update libev-dev openssl-dev gmp-dev gmp
-WORKDIR /home/opam
+COPY . /tmp/build
+WORKDIR /tmp/build
-# Install dependencies
-ADD wormhole.opam wormhole.opam
-RUN opam install . --deps-only
+RUN nix \
+ --extra-experimental-features "nix-command flakes" \
+ --option filter-syscalls false \
+ build
-# Build project
-ADD . .
-RUN opam exec -- dune build -j 1
+RUN mkdir /tmp/nix-store-closure
+RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure
+FROM scratch
-FROM alpine:3.18.4 as run
+WORKDIR /app
-RUN apk add --update libev openssl gmp
-
-COPY --from=build /home/opam/_build/default/bin/main.exe /bin/app
-
-ENTRYPOINT /bin/app
+# Copy /nix/store
+COPY --from=builder /tmp/nix-store-closure /nix/store
+COPY --from=builder /tmp/build/result/ /app
+ENTRYPOINT /app/bin/wormhole