From a93a63a6b7e3d119d488534c3e8573ba6d87cbd8 Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Tue, 29 Aug 2017 18:08:52 +0200 Subject: [PATCH] Docker: Cache cargo downloads with named volume Currently, cargo downloads dependencies on every single run. Get rid of this overhead by caching /home/user/.cargo in a named volume. --- docker/README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index e24f7c0..4d9ad93 100644 --- a/docker/README.md +++ b/docker/README.md @@ -38,6 +38,7 @@ git pull --rebase --recurse-submodules && git submodule sync \ ```shell docker run --cap-add MKNOD --cap-add SYS_ADMIN --device /dev/fuse \ -e LOCAL_UID="$(id -u)" -e LOCAL_GID="$(id -g)" \ + -v redox-"$(id -u)"-"$(id -g)"-cargo:/home/user/.cargo \ -v "$(pwd):/home/user/src" --rm redox make fetch all ``` #### Linux with security modules
@@ -51,11 +52,24 @@ Ex.: for a SELinux only system such as Fedora or CentOS ```shell docker run --cap-add MKNOD --cap-add SYS_ADMIN --device /dev/fuse \ -e LOCAL_UID="$(id -u)" -e LOCAL_GID="$(id -g)" \ - --security-opt label=disable \ + --security-opt label=disable \ + -v redox-"$(id -u)"-"$(id -g)"-cargo:/home/user/.cargo \ -v "$(pwd):/home/user/src" --rm redox make fetch all ``` #### MacOS ```shell docker run --cap-add MKNOD --cap-add SYS_ADMIN --device /dev/fuse \ + -v redox-cargo:/home/user/.cargo \ -v "$(pwd):/home/user/src" --rm redox make fetch all ``` + +### Clear the named volume containing the cargo cache +#### Linux +```shell +docker volume rm redox-"$(id -u)"-"$(id -g)"-cargo +``` + +#### MacOS +```shell +docker volume rm redox-cargo +```