File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 1+ unreleased
2+ ----------
3+
4+ - Cache packages downloads for Apt-based distributions using BuildKit
5+ cache mounts. (@MisterDA , #???)
6+
17v8.2.3 2024-10-30 Rochester
28---------------------------
39
Original file line number Diff line number Diff line change 7676
7777(* * Debian rules *)
7878module Apt = struct
79+ (* https://docs.docker.com/reference/dockerfile/#example-cache-apt-packages *)
80+ let mounts =
81+ [
82+ mount_cache ~target: " /var/cache/apt" ~sharing: `Locked () ;
83+ mount_cache ~target: " /var/lib/apt" ~sharing: `Locked () ;
84+ ]
85+
7986 let update =
80- run " apt-get -y update"
81- @@ run " DEBIAN_FRONTEND=noninteractive apt-get -y upgrade"
87+ run
88+ {| rm - f / etc/ apt/ apt.conf.d/ docker- clean; echo 'Binary ::apt ::APT ::Keep - Downloaded - Packages "true" ; ' > / etc/ apt/ apt.conf.d/ keep- cache| }
89+ @@ run ~mounts
90+ " apt update && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade"
8291
8392 let install fmt =
8493 ksprintf
8594 (fun s ->
86- update @@ run " DEBIAN_FRONTEND=noninteractive apt-get -y install %s" s)
95+ update
96+ @@ run ~mounts
97+ " DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends \
98+ install -y %s"
99+ s)
87100 fmt
88101
89102 let dev_packages ?extra () =
Original file line number Diff line number Diff line change 5959(* * Rules for Apt-based distributions *)
6060module Apt : sig
6161 val update : t
62- (* * [update] will run [apt-get update && apt-get upgrade] non-interactively. *)
62+ (* * [update] will run [apt-get update && apt-get upgrade] non-interactively. Requires [syntax=docker/dockerfile:1]. *)
6363
6464 val install : ('a , unit , string , t ) format4 -> 'a
6565 (* * [install fmt] will [apt-get update && apt-get install] the packages specified by the [fmt] format string. *)
You can’t perform that action at this time.
0 commit comments