A CI container ci needs three kinds of storage:
text
/cache volume build-cache kept between builds
/assets bind ~/project/assets read-only
/tmp/build tmpfs scratch, never on diskFirst, try the bind mount with the wrong path and read the error:
sh
docker run -d --name ci --mount type=bind,source=$HOME/assets,target=/assets alpine:3.20 sleep infinityThen start ci with the correct path and all three mounts:
sh
docker run -d --name ci \
--mount type=volume,source=build-cache,target=/cache \
--mount type=bind,source=$HOME/project/assets,target=/assets,readonly \
--mount type=tmpfs,target=/tmp/build \
alpine:3.20 sleep infinityCheck the result:
sh
docker inspect --format '{{range .Mounts}}{{.Type}} {{.Source}} -> {{.Destination}} rw={{.RW}}{{println}}{{end}}' ci
docker exec ci ls /assets
docker exec ci touch /assets/x