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
+
1
7
v8.2.3 2024-10-30 Rochester
2
8
---------------------------
3
9
Original file line number Diff line number Diff line change 76
76
77
77
(* * Debian rules *)
78
78
module 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
+
79
86
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"
82
91
83
92
let install fmt =
84
93
ksprintf
85
94
(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)
87
100
fmt
88
101
89
102
let dev_packages ?extra () =
Original file line number Diff line number Diff line change 59
59
(* * Rules for Apt-based distributions *)
60
60
module Apt : sig
61
61
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]. *)
63
63
64
64
val install : ('a , unit , string , t ) format4 -> 'a
65
65
(* * [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