Don't rebuild everything after even slightest change
The line COPY ./.devpod-internal/ /tmp/build-features/ in generated Dockerfile makes full rebuild even after tiniest changes in devcontainer.json. This is unprzctical. Why not add ./.devpod-internal/0 then ./.devpod-internal/1 and so on???
Enabling cache for apt, npm, pip, and similar commands (with RUN --mount) would also help a lot. Currently devpod image building is slow, so slow that it's almost useless to me and I have to switch to competition.
Hi @iirekm, I'm not sure why iterating over each ./.devpod-internal/X would help, this is the same as doing the former. Any change to .devcontainer.json will result in a different environment so the Dockerfile will need to be rebuilt.
You can use RUN --mount in your dockerfile, devpod supports this. Can you please clarify what you want devpod to change for this ticket?
Something like:
ADD install-feature-1.sh
RUN install-feature-1.sh
ADD install-feature-2.sh
RUN install-feature-2.sh
ADD install-feature-3.sh
RUN install-feature-3.sh
Is much faster than putting all at once, because if I reconfigure only feature 3, only the last layer has to be rebuilt. Most developers expect that the most experimental things, that are most likely to change or be reconfigured soon, should be put at end of Dockerfile, the most stable or the biggest ones - at top of Dockerfile. The same should probably be true for features: [...]" in devcontainers.json (if I put one I'm not sure at the end, I would expect it to rebuild fast).
With current approach all layers have to be rebuilt, no matter whether I change 1st or last feature, and some developer's tools (e.g. Rust, Android) do take some time to install.
Another easy to apply optimization technique is --mount to avoid re-downloading .deb, .whl and other files even if a layer has to be rebuilt, for example: RUN --mount=target=/var/cache/apt/archives,type=cache,sharing=locked apt-get install -y ... - why simply not add these to every RUN line above to cache downloads of all most common package managers (apt, pip, npm, rust, ...)? No matter what the install script contains, the downloads would be cached.
I know I can create own Dockerfiles (and I actually now do to address the performance issues above), but this requires lots of copy and paste between projects. Devcontainers features were created to improve reusability.
So to sum up, something like the following should help a lot:
ADD install-feature-1.sh
RUN --mounts for all popular package managers install-feature-1.sh
ADD install-feature-2.sh
RUN--mounts for all popular package managers install-feature-2.sh
ADD install-feature-3.sh
RUN --mounts for all popular package managers install-feature-3.sh
This issue is stale because it has been open for 60 days with no activity.
This issue was closed because it has been inactive for 30 days since being marked as stale.