defang icon indicating copy to clipboard operation
defang copied to clipboard

Support local volumes

Open lionello opened this issue 1 year ago • 4 comments

Add support for locally mapped volumes. This could be implemented by building a sidecar image from the mapped files.

version: '3'
services:
  nextjs:
    restart: always
    image: caddy:2.7.6
    command: ["caddy", "file-server", "--root", "/static", "--listen", ":80"]
    #x-defang-static-files: /static
    volumes:
      - ./:/static
    ports:
      - target: 80
        published: 8000
        mode: ingress

Currently this emits a warning.

lionello avatar Apr 19 '24 00:04 lionello

See also #490

lionello avatar Jun 24 '24 23:06 lionello

This requires volume support, before we're able to copy the local files into the created volume.

lionello avatar Jun 26 '24 19:06 lionello

I'm going to flag that this issue seems to be about mounting files from a local build context into a volume, as opposed to #818 which is about creating a volume that should be populated by the image at runtime/and persisted.

raphaeltm avatar Oct 31 '24 21:10 raphaeltm

Though... depending on implementation, I guess these could work similarly:

  • When defang compose up is run, we create a cloud volume (EBS or something)
    • If they're using the ./localdir:/containerdir syntax, we create it based on the ./localdir name
    • If they're using the volumename:/containerdir syntax we create it based on the volumename
  • If they're using the ./localdir:/containerdir syntax, we check if there is anything in the volume
    • If there is, we copy that to the cloud volume

We need to figure out, with the ./localdir:/containerdir syntax, if we just upload the local data the first time the user runs defang compose up or every time.

I suspect we'll need a bunch of warnings to make this usable and safe at the same time.

raphaeltm avatar Oct 31 '24 21:10 raphaeltm