there’s a lot of things about my docker + vscode setup that are really annoying to me. i figured out 2 weeks ago how to get a remote container running, and that has already been a big improvement for me from using Atom before. but i wish i could rebuild the docker container with the Rebuild Container dialog without having to delete all the .build
directories because there really are a lot of them, especially if you are like me and use swift package edit
a lot and have a lot of nested SPM projects at a time.
error checking context: 'can't stat '.build/x86_64-unknown-linux-gnu/debug/ModuleCache''.
and i rebuild the image over and over again because if i try to expose ports with the devcontainer.json
it doesn’t work unless i rebuild the whole image.
and then there is @johannesweiss ’s incremental build trick which if i could learn how to do it would save me a lot of time because swift-nio-ssl
takes such a long time to compile but i don’t know where to put the --mount=type=cache,target=/code/.build
in the devcontainer.json
or in the dockerfile or what /code/.build
is supposed to be because the directory layout is different in the host and in the container, and when i try --mount=type=cache
it says cache
is not a mount type:
[11350 ms] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/home/klossy/host-project,target=/workspaces/container-project --mount type=volume,src=vscode,dst=/vscode -l devcontainer.local_folder=/home/klossy/host-project --cap-add=NET_ADMIN -p 80:80 -p 443:443 --mount=type=cache,target=/workspaces/container-project/.build --entrypoint /bin/sh vsc-swiftinit.org-804c4a4ab43ecd3d8f6619cceea10125 -c echo Container started
WARNING: Error loading config file: /home/klossy/.docker/config.json: open /home/klossy/.docker/config.json: permission denied
docker: Error response from daemon: invalid mount config for type "cache": mount type unknown.
so i really wish there was a guide for how to do this because i swear i remember there was one but there is nothing on Swift.org - Installing Swift and using with IDEs anymore and the links just go backwards to swift.org or the vscode website.