aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorMarc Coquand <marcc@fastmail.fr>2023-12-04 19:33:34 -0600
committerMarc Coquand <marcc@fastmail.fr>2023-12-04 19:33:34 -0600
commit5802ae011093ca4e138ad82fcd0ee14bbcc6f20f (patch)
treeffd49a3d25fd61e35c1f379a9ce150908485cafc /Dockerfile
parent2c6445f32891a5f7163fbf9b1d13613ba16832c7 (diff)
downloadwormhole-5802ae011093ca4e138ad82fcd0ee14bbcc6f20f.tar.gz
wormhole-5802ae011093ca4e138ad82fcd0ee14bbcc6f20f.tar.bz2
wormhole-5802ae011093ca4e138ad82fcd0ee14bbcc6f20f.zip
Add nix
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