Any downside for mounting the drive root as temporary?

I’ve began using those nifty temporary volumes, with PHP the modules and such lie in many different directories.

So my question is: Is it smart/stupid/inefficient to mount the drive root temporarily?

The major issue is I do not know which files are used by the hundreds of dependencies I have to install.

steps:
- name: Install Stuff
  image: debian:buster
  volumes:
  - name: root
    path: /
  commands:
  - apt-get update
  - apt-get install somelibrary

- name: Use Stuff
  image: debian:buster
  volumes:
  - name: root
    path: /
  commands:
  - some_executable

volumes:
- name: root
  temp: {}

If you mount the root directory, you would override the contents of the debian:buster image, and you would be left with an empty os. Instead of trying to mount a volume to share apt packages, we would generally recommend building and publishing an image to dockerhub with everything you need installed, and then using that image in your yaml.

I see thanks! Did not know that the temporary volume overwrites. Thought it would create a bridge between the steps.

It does create a bridge in between steps and can be useful for sharing state between steps [1], however, when you mount a volume you effectively overwrite the original contents of the target mount path. If you overwrite the root directory, you effectively overwrite the entire docker image, resulting in an empty image.

[1] https://docs.drone.io/pipeline/docker/examples/languages/golang/#dependencies