Workspaces and Image Volumes

I’m having some trouble figuring out if I can do the following in Drone, I have a Dockerfile that looks something like this:

FROM baseimage

COPY package.json yarn.lock /apps/name
RUN yarn install && yarn cache clean

This bakes /app/node_modules into the image, now in docker-compose, I can do something like:

    volumes:
      - ./:/apps/name
      - /apps/name/node_modules

However, I can’t seem to figure out how to duplicate this behavior in Drone… Using workspace I have:

workspace:
  base: /apps
  path: name

This’ll obviously override /apps/name dropping node_modules, and I can’t figure out how to get it back. I tried adding volumes: [ /apps/name/node_modules ] to each build step as:

  build:
    image: image_with_node_modules
    commands: [ … ]
    volumes: [ /apps/name/node_modules ]

However I’m getting an Insufficient privileges to use volumes error – given that this path is already within the running image, I’d rather not escalate permissions here (if that would even work?)

Any insight here would be greatly appreciated!

1 Like