1- FROM ocaml/opam: alpine- 3.21-ocaml-5.2 AS build
1+ FROM alpine: 3.21 AS build
22
33# Install system dependencies
4- RUN sudo apk -U upgrade --no-cache && sudo apk add --no-cache \
4+ RUN apk -U upgrade --no-cache && apk add --no-cache \
5+ # to download and install Dune Developer Preview with alpine:3.21
6+ build-base patch tar ca-certificates git rsync curl sudo bash \
7+ libx11-dev nano coreutils xz \
58 autoconf \
69 curl-dev \
710 gmp-dev \
@@ -10,39 +13,34 @@ RUN sudo apk -U upgrade --no-cache && sudo apk add --no-cache \
1013 oniguruma-dev \
1114 openssl-dev
1215
13- # Use Opam 2.2 and enable the backup mirror if primary sources of packages are unavailable
14- RUN sudo mv /usr/bin/opam-2.2 /usr/bin/opam && opam update
15- RUN opam option --global 'archive-mirrors+="https://opam.ocaml.org/cache"'
16-
17- # Branch freeze was opam-repo HEAD at the time of commit
18- RUN cd ~/opam-repository && git reset --hard 584630e7a7e27e3cf56158696a3fe94623a0cf4f && opam update
19-
20- WORKDIR /home/opam
21-
22- # Install opam dependencies
23- COPY --chown=opam ocamlorg.opam .
24- RUN opam install . --deps-only
16+ # Install Dune Developer Preview
17+ RUN curl -fsSL https://get.dune.build/install | sh
18+ RUN /bin/bash -c 'source "/root/.local/share/dune/env/env.bash"'
19+ ENV PATH="/root/.local/bin:$PATH"
2520
2621# Build project
27- COPY --chown=opam . .
28- RUN opam exec -- dune build @install --profile=release
22+ WORKDIR "/root/ocaml.org"
23+ COPY --chown=root . .
24+ RUN ls
25+
26+ RUN dune pkg lock
27+ RUN dune build @install --profile=release
2928
3029# Launch project in order to generate the package state cache
31- RUN cd ~/opam-repository && git checkout master && git pull origin master && opam update
3230ENV OCAMLORG_PKG_STATE_PATH=package.state \
3331 OCAMLORG_REPO_PATH=opam-repository
3432RUN touch package.state && ./init-cache package.state
3533
36- FROM alpine:3.19
34+ FROM alpine:3.21
3735
3836RUN apk -U upgrade --no-cache && apk add --no-cache \
3937 git \
4038 gmp \
4139 libev
4240
43- COPY --from=build /home/opam /package.state /var/package.state
44- COPY --from=build /home/opam /opam-repository /var/opam-repository
45- COPY --from=build /home/opam /_build/default/src/ocamlorg_web/bin/main.exe /bin/server
41+ COPY --from=build "/root/ocaml.org /package.state" /var/package.state
42+ COPY --from=build "/root/ocaml.org /opam-repository" /var/opam-repository
43+ COPY --from=build "/root/ocaml.org /_build/default/src/ocamlorg_web/bin/main.exe" /bin/server
4644
4745COPY playground/asset playground/asset
4846
0 commit comments