diff --git a/.dockerignore b/.dockerignore index 3f797b2..1cf39e1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ * !dune !dune-project -!sandworm.opam +!dune.lock !bin/ !lib/ !static/ diff --git a/Dockerfile b/Dockerfile index 915b67a..6684727 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,20 @@ -FROM ocaml/opam:alpine-3.23-ocaml-5.4 AS build - -RUN sudo apk update && \ - sudo apk add curl git curl-dev libev-dev openssl-dev gmp-dev && \ - sudo ln -f /usr/bin/opam-2.5 /usr/bin/opam && opam init --reinit -ni && \ - opam update -y - -WORKDIR /home/opam -COPY sandworm.opam sandworm.opam -RUN opam install . --deps-only -y -COPY --chown=opam:opam . . -RUN opam exec -- dune build --release +FROM alpine:3.23 AS build +RUN apk update && \ + apk add curl git musl-dev linux-headers make dune gcc +WORKDIR /home/sandworm +COPY . . +# There is a bug that makes Dune believe the lock file is out of date. +# This is not the case, thus we disable the check by removing the hash from +# the lock file as a (temporary) workaround +RUN sed -i /dependency_hash/d dune.lock/lock.dune +RUN apk add $(dune show depexts 2>&1) +RUN dune build --release FROM alpine:3.23 AS run RUN apk update && apk add --update libev gmp git WORKDIR /app -COPY --from=build /home/opam/static static -COPY --from=build /home/opam/metadata.json ./metadata.json -COPY --from=build /home/opam/_build/install/default/bin/sandworm /bin/sandworm +COPY --from=build /home/sandworm/static static +COPY --from=build /home/sandworm/metadata.json ./metadata.json +COPY --from=build /home/sandworm/_build/install/default/bin/sandworm /bin/sandworm EXPOSE 80 -CMD [ "sandworm", "serve", "--port", "80"] +CMD ["sandworm", "serve", "--port", "80"] diff --git a/dune-workspace b/dune-workspace new file mode 100644 index 0000000..1b00fe2 --- /dev/null +++ b/dune-workspace @@ -0,0 +1,8 @@ +(lang dune 3.20) +(pkg enabled) + +(lock_dir + (path dune.lock) + (constraints + (dune-configurator (<= 3.21)) + (dune-private-libs (<= 3.21)))) diff --git a/dune.lock/dune-configurator.3.21.1.pkg b/dune.lock/dune-configurator.3.20.2.pkg similarity index 64% rename from dune.lock/dune-configurator.3.21.1.pkg rename to dune.lock/dune-configurator.3.20.2.pkg index 835aaef..eb4df70 100644 --- a/dune.lock/dune-configurator.3.21.1.pkg +++ b/dune.lock/dune-configurator.3.20.2.pkg @@ -1,4 +1,4 @@ -(version 3.21.1) +(version 3.20.2) (build (all_platforms @@ -16,6 +16,6 @@ (source (fetch (url - https://github.com/ocaml/dune/releases/download/3.21.1/dune-3.21.1.tbz) + https://github.com/ocaml/dune/releases/download/3.20.2/dune-3.20.2.tbz) (checksum - sha256=84f7a82c6d80a7124f3847e9a489e80cfbeafb7bed3573ac01286ef56fd08d94))) + sha256=b1a86b2d60bdb4a8b9bb6861bdf2f9f28a6e7cb5d833ce81afecceb9ef9ca549))) diff --git a/dune.lock/dune-private-libs.3.21.1.pkg b/dune.lock/dune-private-libs.3.20.2.pkg similarity index 65% rename from dune.lock/dune-private-libs.3.21.1.pkg rename to dune.lock/dune-private-libs.3.20.2.pkg index 9bb0068..c00a16b 100644 --- a/dune.lock/dune-private-libs.3.21.1.pkg +++ b/dune.lock/dune-private-libs.3.20.2.pkg @@ -1,4 +1,4 @@ -(version 3.21.1) +(version 3.20.2) (build (all_platforms @@ -16,6 +16,6 @@ (source (fetch (url - https://github.com/ocaml/dune/releases/download/3.21.1/dune-3.21.1.tbz) + https://github.com/ocaml/dune/releases/download/3.20.2/dune-3.20.2.tbz) (checksum - sha256=84f7a82c6d80a7124f3847e9a489e80cfbeafb7bed3573ac01286ef56fd08d94))) + sha256=b1a86b2d60bdb4a8b9bb6861bdf2f9f28a6e7cb5d833ce81afecceb9ef9ca549))) diff --git a/dune.lock/dune-site.3.21.1.pkg b/dune.lock/dune-site.3.20.2.pkg similarity index 64% rename from dune.lock/dune-site.3.21.1.pkg rename to dune.lock/dune-site.3.20.2.pkg index f050ce9..d3a807f 100644 --- a/dune.lock/dune-site.3.21.1.pkg +++ b/dune.lock/dune-site.3.20.2.pkg @@ -1,4 +1,4 @@ -(version 3.21.1) +(version 3.20.2) (build (all_platforms @@ -16,6 +16,6 @@ (source (fetch (url - https://github.com/ocaml/dune/releases/download/3.21.1/dune-3.21.1.tbz) + https://github.com/ocaml/dune/releases/download/3.20.2/dune-3.20.2.tbz) (checksum - sha256=84f7a82c6d80a7124f3847e9a489e80cfbeafb7bed3573ac01286ef56fd08d94))) + sha256=b1a86b2d60bdb4a8b9bb6861bdf2f9f28a6e7cb5d833ce81afecceb9ef9ca549))) diff --git a/dune.lock/dyn.3.21.1.pkg b/dune.lock/dyn.3.20.2.pkg similarity index 64% rename from dune.lock/dyn.3.21.1.pkg rename to dune.lock/dyn.3.20.2.pkg index 14b036d..5bb9315 100644 --- a/dune.lock/dyn.3.21.1.pkg +++ b/dune.lock/dyn.3.20.2.pkg @@ -1,4 +1,4 @@ -(version 3.21.1) +(version 3.20.2) (build (all_platforms @@ -16,6 +16,6 @@ (source (fetch (url - https://github.com/ocaml/dune/releases/download/3.21.1/dune-3.21.1.tbz) + https://github.com/ocaml/dune/releases/download/3.20.2/dune-3.20.2.tbz) (checksum - sha256=84f7a82c6d80a7124f3847e9a489e80cfbeafb7bed3573ac01286ef56fd08d94))) + sha256=b1a86b2d60bdb4a8b9bb6861bdf2f9f28a6e7cb5d833ce81afecceb9ef9ca549))) diff --git a/dune.lock/fs-io.3.21.1.pkg b/dune.lock/fs-io.3.21.1.pkg deleted file mode 100644 index 6e9a596..0000000 --- a/dune.lock/fs-io.3.21.1.pkg +++ /dev/null @@ -1,21 +0,0 @@ -(version 3.21.1) - -(build - (all_platforms - ((action - (progn - (when %{pkg-self:dev} (run dune subst)) - (run rm -rf vendor/csexp) - (run rm -rf vendor/pp) - (run dune build -p %{pkg-self:name} -j %{jobs} @install)))))) - -(depends - (all_platforms - (dune base-unix ocaml))) - -(source - (fetch - (url - https://github.com/ocaml/dune/releases/download/3.21.1/dune-3.21.1.tbz) - (checksum - sha256=84f7a82c6d80a7124f3847e9a489e80cfbeafb7bed3573ac01286ef56fd08d94))) diff --git a/dune.lock/lock.dune b/dune.lock/lock.dune index 89b6a89..db068d7 100644 --- a/dune.lock/lock.dune +++ b/dune.lock/lock.dune @@ -10,7 +10,7 @@ ((source https://github.com/ocaml-dune/opam-overlays.git#2a9543286ff0e0656058fee5c0da7abc16b8717d)) ((source - https://github.com/ocaml/opam-repository.git#4d2d05075ed20338fa6af3429fc5c18858025bd3)))) + https://github.com/ocaml/opam-repository.git#1e2ff749f83856d7d062692d6171f3f79e4aac8a)))) (expanded_solver_variable_bindings (variable_values diff --git a/dune.lock/ordering.3.21.1.pkg b/dune.lock/ordering.3.20.2.pkg similarity index 63% rename from dune.lock/ordering.3.21.1.pkg rename to dune.lock/ordering.3.20.2.pkg index 36d562a..0b0092a 100644 --- a/dune.lock/ordering.3.21.1.pkg +++ b/dune.lock/ordering.3.20.2.pkg @@ -1,4 +1,4 @@ -(version 3.21.1) +(version 3.20.2) (build (all_platforms @@ -16,6 +16,6 @@ (source (fetch (url - https://github.com/ocaml/dune/releases/download/3.21.1/dune-3.21.1.tbz) + https://github.com/ocaml/dune/releases/download/3.20.2/dune-3.20.2.tbz) (checksum - sha256=84f7a82c6d80a7124f3847e9a489e80cfbeafb7bed3573ac01286ef56fd08d94))) + sha256=b1a86b2d60bdb4a8b9bb6861bdf2f9f28a6e7cb5d833ce81afecceb9ef9ca549))) diff --git a/dune.lock/stdune.3.20.2.pkg b/dune.lock/stdune.3.20.2.pkg new file mode 100644 index 0000000..0e2a1d4 --- /dev/null +++ b/dune.lock/stdune.3.20.2.pkg @@ -0,0 +1,21 @@ +(version 3.20.2) + +(build + (all_platforms + ((action + (progn + (when %{pkg-self:dev} (run dune subst)) + (run rm -rf vendor/csexp) + (run rm -rf vendor/pp) + (run dune build -p %{pkg-self:name} -j %{jobs} @install)))))) + +(depends + (all_platforms + (dune ocaml base-unix dyn ordering pp csexp))) + +(source + (fetch + (url + https://github.com/ocaml/dune/releases/download/3.20.2/dune-3.20.2.tbz) + (checksum + sha256=b1a86b2d60bdb4a8b9bb6861bdf2f9f28a6e7cb5d833ce81afecceb9ef9ca549))) diff --git a/dune.lock/stdune.3.21.1.pkg b/dune.lock/stdune.3.21.1.pkg deleted file mode 100644 index d3adf9a..0000000 --- a/dune.lock/stdune.3.21.1.pkg +++ /dev/null @@ -1,21 +0,0 @@ -(version 3.21.1) - -(build - (all_platforms - ((action - (progn - (when %{pkg-self:dev} (run dune subst)) - (run rm -rf vendor/csexp) - (run rm -rf vendor/pp) - (run dune build -p %{pkg-self:name} -j %{jobs} @install)))))) - -(depends - (all_platforms - (dune ocaml base-unix csexp dyn fs-io ordering pp top-closure))) - -(source - (fetch - (url - https://github.com/ocaml/dune/releases/download/3.21.1/dune-3.21.1.tbz) - (checksum - sha256=84f7a82c6d80a7124f3847e9a489e80cfbeafb7bed3573ac01286ef56fd08d94))) diff --git a/dune.lock/top-closure.3.21.1.pkg b/dune.lock/top-closure.3.21.1.pkg deleted file mode 100644 index 36d562a..0000000 --- a/dune.lock/top-closure.3.21.1.pkg +++ /dev/null @@ -1,21 +0,0 @@ -(version 3.21.1) - -(build - (all_platforms - ((action - (progn - (when %{pkg-self:dev} (run dune subst)) - (run rm -rf vendor/csexp) - (run rm -rf vendor/pp) - (run dune build -p %{pkg-self:name} -j %{jobs} @install)))))) - -(depends - (all_platforms - (dune ocaml))) - -(source - (fetch - (url - https://github.com/ocaml/dune/releases/download/3.21.1/dune-3.21.1.tbz) - (checksum - sha256=84f7a82c6d80a7124f3847e9a489e80cfbeafb7bed3573ac01286ef56fd08d94)))