Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*
!dune
!dune-project
!sandworm.opam
!dune.lock
!bin/
!lib/
!static/
Expand Down
31 changes: 15 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

@shonfeder shonfeder Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment noting why this is necessary?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Leonidas-from-XIV mentioned that the dependency hash was being out of sync in the docker container and he had yet to determine the cause. I believe this line was an attempt at removing it. I'm not particularly sure what caused this issue yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly right. If I leave it out I get the error that's mentioned in the opening message of the PR.

I plan to create a repro case for this issue (which seems like a Dune bug) which should help debug this issue in a separate repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! Sounds like this is still under investigation. If ends up needing to be in the final state of the PR, I just request it be with a comment explaining why it is needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes it clear! Linking to the issue tracking this bug will make it easier to know when this workaround can be removed.

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"]
8 changes: 8 additions & 0 deletions dune-workspace
Original file line number Diff line number Diff line change
@@ -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))))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(version 3.21.1)
(version 3.20.2)

(build
(all_platforms
Expand All @@ -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)))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(version 3.21.1)
(version 3.20.2)

(build
(all_platforms
Expand All @@ -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)))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(version 3.21.1)
(version 3.20.2)

(build
(all_platforms
Expand All @@ -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)))
6 changes: 3 additions & 3 deletions dune.lock/dyn.3.21.1.pkg → dune.lock/dyn.3.20.2.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(version 3.21.1)
(version 3.20.2)

(build
(all_platforms
Expand All @@ -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)))
21 changes: 0 additions & 21 deletions dune.lock/fs-io.3.21.1.pkg

This file was deleted.

2 changes: 1 addition & 1 deletion dune.lock/lock.dune
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(version 3.21.1)
(version 3.20.2)

(build
(all_platforms
Expand All @@ -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)))
21 changes: 21 additions & 0 deletions dune.lock/stdune.3.20.2.pkg
Original file line number Diff line number Diff line change
@@ -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)))
21 changes: 0 additions & 21 deletions dune.lock/stdune.3.21.1.pkg

This file was deleted.

21 changes: 0 additions & 21 deletions dune.lock/top-closure.3.21.1.pkg

This file was deleted.