Skip to content

Support local volumes #288

@lionello

Description

@lionello

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.


Discussion on what we should do based on customer needs, when do we need volumes?

  1. Dumb static website case, i.e. snake game by vibe coder. Very rarely there is code should be served without a building step, i.e. typescript, react, nextjs etc. This is already covered by current static-website case, or the user would be having a dockerfile for building, which would not require volume mount
  2. Mounting large files at runtime to avoid building huge images, i.e. LLM models. This is no longer needed by the majority, as most people use hosted models
  3. Mounting a volume to read-write files: most likely application needs to persist state as files locally
  • Due to software limitation, not able to use a remote database, or by design, i.e. NATS use case
  • Due to inexperience: It is nearly impossible to share read/write files correctly amongst multiple instances, will not scale

As a result, the most useful volume mount support we can provide for our users are, single instance mount to a disk with RO/RW support. This may also be extended to covers case 1, where a dumb website could be served from it if we implement data copy to the volume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions