Open ewdurbin opened 3 months ago
just hacking around a bit, applied this diff (orbstack dependent!):
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..9ff6842
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,15 @@
+---
+version: '3'
+
+services:
+ apt-cacher-ng:
+ image: sameersbn/apt-cacher-ng
+ container_name: apt-cacher-ng
+ ports:
+ - "3142:3142"
+ volumes:
+ - apt-cacher-ng:/var/cache/apt-cacher-ng
+ restart: always
+
+volumes:
+ apt-cacher-ng:
diff --git a/dockerfiles/Dockerfile.jammy b/dockerfiles/Dockerfile.jammy
index 303bb4a..a3bb4df 100644
--- a/dockerfiles/Dockerfile.jammy
+++ b/dockerfiles/Dockerfile.jammy
@@ -8,6 +8,9 @@ ENV container docker
RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo $TZ > /etc/timezone
+RUN echo 'Acquire::HTTP::Proxy "http://apt-cacher-ng.psf-salt.orb.local:3142";' >> /etc/apt/apt.conf.d/01proxy \
+ && echo 'Acquire::HTTPS::Proxy "false";' >> /etc/apt/apt.conf.d/01proxy
+
RUN apt-get update -y && apt-get dist-upgrade -y
# Install system dependencies, you may not need all of these
diff --git a/dockerfiles/Dockerfile.noble b/dockerfiles/Dockerfile.noble
index 944a0d4..0b68457 100644
--- a/dockerfiles/Dockerfile.noble
+++ b/dockerfiles/Dockerfile.noble
@@ -8,6 +8,9 @@ ENV container docker
RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo $TZ > /etc/timezone
+RUN echo 'Acquire::HTTP::Proxy "http://apt-cacher-ng.psf-salt.orb.local:3142";' >> /etc/apt/apt.conf.d/01proxy \
+ && echo 'Acquire::HTTPS::Proxy "false";' >> /etc/apt/apt.conf.d/01proxy
+
RUN apt-get update -y && apt-get dist-upgrade -y
# Install system dependencies, you may not need all of these
and saw the following result for time vagrant up salt-master
:
Before:
real 7m35.815s
user 0m2.657s
sys 0m1.049s
After (after docker compose up
ing the cache container and running once to fill up the cache):
real 5m18.678s
user 0m2.630s
sys 0m1.027s
So the potential win is pretty clear given that the "Before" is basically best case when ports is behaving, but I have some concerns about how to do this more ergonomically. Currently needing to docker compose up
and remember to do so is kind of a pain and isn't "built in". If you forget to the whole thing fails kinda miserably. Also it's relying on orbstack magic DNS to make the container discoverable... which isn't ideal.
ARM64 packages for Ubuntu are not served off of the main mirror network, but rather ports.ubuntu.com.
@JacobCoffee and I have noticed poor performance from this service when running psf-salt Vagrant containers on Apple Silicon (arm64).
We should research ways to improve this situation and maybe implement something like a transparent caching proxy when running locally.