Support local volumes
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.
See also #490
This requires volume support, before we're able to copy the local files into the created volume.
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.
Though... depending on implementation, I guess these could work similarly:
- When
defang compose upis run, we create a cloud volume (EBS or something)- If they're using the
./localdir:/containerdirsyntax, we create it based on the./localdirname - If they're using the
volumename:/containerdirsyntax we create it based on thevolumename
- If they're using the
- If they're using the
./localdir:/containerdirsyntax, 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.