From 74c9d31dd7c8856efb2da5a1d612a9a101763704 Mon Sep 17 00:00:00 2001 From: Natalie Rose Date: Wed, 9 Sep 2026 16:07:39 +1000 Subject: [PATCH] Optimise docker layers --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5d6b6f9b..0d820eb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ FROM perl:5.40-bookworm ENV ANYEVENT_WEBSOCKET_TEST_SKIP_SSL=1 -COPY . /home/lacuna/server WORKDIR /home/lacuna/server # System libraries the XS dependencies link against (Debian package names). @@ -32,12 +31,16 @@ RUN cpanm --notest Carton RUN cpanm --notest -l local --build-timeout=3600 --configure-timeout=1800 \ Memcached::libmemcached@1.001801 +COPY ./cpanfile ./cpanfile.snapshot /home/lacuna/server + # With a committed cpanfile.snapshot, install strictly from it (reproducible). # On the very first build (no snapshot yet), resolve freely and generate one — # extract it with `docker cp` and commit it, then all later builds are pinned. RUN carton install --deployment \ && rm -rf /root/.cpanm /root/.perl-cpm +COPY . /home/lacuna/server + # Carton installs into ./local — put its binaries and libs on the default # search paths so `plackup` / `perl` in bin/startdev.sh and the compose # `command:` lines resolve without needing `carton exec`. -- 2.51.2