diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d08ec0581..93b435a1f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - macos-latest - ubuntu-latest ocaml-compiler: - - "5.2.0" + - "5.2" steps: - name: Checkout Repo @@ -35,7 +35,7 @@ jobs: ocaml-compiler: ${{ matrix.ocaml-compiler }} dune-cache: ${{ matrix.os != 'macos-latest' }} opam-repositories: | - pin: git+https://github.com/ocaml/opam-repository#c45f5bab71d3589f41f9603daca5acad14df0ab0 + pin: git+https://github.com/ocaml/opam-repository#2c9566f0b0de5ab6dad7ce8d22b68a2999a1861f opam-disable-sandboxing: true - name: Install system dependencies (Linux) diff --git a/.github/workflows/debug-ci.yml b/.github/workflows/debug-ci.yml index 0c10658e11..3ba70eb22c 100644 --- a/.github/workflows/debug-ci.yml +++ b/.github/workflows/debug-ci.yml @@ -16,7 +16,7 @@ jobs: - macos-latest - ubuntu-latest ocaml-compiler: - - "5.2.0" + - "5.2" steps: - name: Checkout Repo @@ -28,7 +28,7 @@ jobs: ocaml-compiler: ${{ matrix.ocaml-compiler }} dune-cache: ${{ matrix.os != 'macos-latest' }} opam-repositories: | - pin: git+https://github.com/ocaml/opam-repository#c45f5bab71d3589f41f9603daca5acad14df0ab0 + pin: git+https://github.com/ocaml/opam-repository#2c9566f0b0de5ab6dad7ce8d22b68a2999a1861f opam-disable-sandboxing: true - name: Install system dependencies (Linux) diff --git a/Dockerfile b/Dockerfile index 8698cc0c5e..1e194669d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,11 @@ -FROM ocaml/opam:alpine-3.19-ocaml-5.2 AS build +# syntax=docker/dockerfile:1 +FROM ocaml/opam:alpine-3.21-ocaml-5.2 AS build +RUN sudo ln -sf /usr/bin/opam-2.3 /usr/bin/opam && opam init --reinit -ni # Install system dependencies -RUN sudo apk -U upgrade --no-cache && sudo apk add --no-cache \ +RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \ + sudo ln -s /var/cache/apk /etc/apk/cache && \ + sudo apk -U upgrade && sudo apk add \ autoconf \ curl-dev \ gmp-dev \ @@ -11,13 +15,14 @@ RUN sudo apk -U upgrade --no-cache && sudo apk add --no-cache \ openssl-dev # Branch freeze was opam-repo HEAD at the time of commit -RUN cd ~/opam-repository && git reset --hard c45f5bab71d3589f41f9603daca5acad14df0ab0 && opam update +RUN cd ~/opam-repository && git reset --hard 2c9566f0b0de5ab6dad7ce8d22b68a2999a1861f && opam update WORKDIR /home/opam # Install opam dependencies -COPY --chown=opam ocamlorg.opam . -RUN opam install . --deps-only +COPY --chown=opam --link ocamlorg.opam . +RUN --mount=type=cache,target=/home/opam/.opam/download-cache,sharing=locked,uid=1000,gid=1000 \ + opam install . --deps-only # Build project COPY --chown=opam . . @@ -29,21 +34,24 @@ ENV OCAMLORG_PKG_STATE_PATH=package.state \ OCAMLORG_REPO_PATH=opam-repository RUN touch package.state && ./init-cache package.state -FROM alpine:3.19 -RUN apk -U upgrade --no-cache && apk add --no-cache \ +FROM alpine:3.21 + +RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \ + ln -s /var/cache/apk /etc/apk/cache && \ + apk -U upgrade && apk add \ git \ gmp \ libev -COPY --from=build /home/opam/package.state /var/package.state -COPY --from=build /home/opam/opam-repository /var/opam-repository -COPY --from=build /home/opam/_build/default/src/ocamlorg_web/bin/main.exe /bin/server +COPY --from=build --link /home/opam/package.state /var/package.state +COPY --from=build --link /home/opam/opam-repository /var/opam-repository +COPY --from=build --link /home/opam/_build/default/src/ocamlorg_web/bin/main.exe /bin/server -COPY playground/asset playground/asset +COPY --link playground/asset playground/asset -RUN git clone https://github.com/ocaml-web/html-compiler-manuals /manual -ADD data/v2 /v2 +ADD --keep-git-dir --link https://github.com/ocaml-web/html-compiler-manuals /manual +COPY --link data/v2 /v2 RUN git config --global --add safe.directory /var/opam-repository