Skip to content

Commit 0b509b5

Browse files
committed
make Dockerfile use Dune Developer Preview to build
1 parent 286479b commit 0b509b5

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
!tool/
77
!dune
88
!dune-project
9-
!ocamlorg.opam
9+
!dune-workspace
1010
!tailwind.config.js
1111
!init-cache
1212
!.git

Dockerfile

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
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
3230
ENV OCAMLORG_PKG_STATE_PATH=package.state \
3331
OCAMLORG_REPO_PATH=opam-repository
3432
RUN touch package.state && ./init-cache package.state
3533

36-
FROM alpine:3.19
34+
FROM alpine:3.21
3735

3836
RUN 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

4745
COPY playground/asset playground/asset
4846

init-cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ STATE=$1
44

55
rm -f $STATE
66
touch $STATE
7-
opam exec -- dune exec src/ocamlorg_web/bin/main.exe &
7+
dune exec src/ocamlorg_web/bin/main.exe &
88
PID=$!
99
echo PID=$PID
1010
inotifywait -e close_write $STATE

0 commit comments

Comments
 (0)