How can embed webui in docker

Your question

Hi

I’m use docker
but every time i’m use docker up, the container start downloading the webui zip
and my server can’t reach internet so failed

I’m try to cache it but can’t find any way

my compose file

services:
  mail:
    image: stalwartlabs/stalwart:v0.16

    # deploy:
    #   resources:
    #     limits:
    #       cpus: "0.5"
    #       memory: 512m

    security_opt:
      - no-new-privileges:true

    restart: unless-stopped

    networks:
      - proxy

    ports:
      - "25:25"
      - "143:143"
      - "993:993"
      - "587:587"
      - "465:465"

    volumes:
      - ./data:/opt/stalwart/data:z
      - ./etc:/etc/stalwart:z
    environment:
      - TZ=Asia/Tehran
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.stalwart-proxy-http.rule=Host(`mail.mynexim.ir`)"
      - "traefik.http.routers.stalwart-proxy-http.entrypoints=web"
      - "traefik.http.routers.stalwart-proxy-http.middlewares=stalwart-redirect-https"
      - "traefik.http.middlewares.stalwart-redirect-https.redirectscheme.scheme=https"
      - "traefik.http.routers.stalwart-proxy-https.rule=Host(`mail.mynexim.ir`)"
      - "traefik.http.routers.stalwart-proxy-https.entrypoints=websecure"
      - "traefik.http.routers.stalwart-proxy-https.tls=true"
      - "traefik.http.services.stalwart-proxy.loadbalancer.server.port=443"
      - "traefik.http.services.stalwart-proxy.loadbalancer.server.scheme=https"

networks:
  proxy:
    external: true

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

The problem and solution are clearly documented. Here is a summary:

The WebUI is not bundled inside the Docker image. On first start, Stalwart downloads the WebUI bundle from https://github.com/stalwartlabs/webui/releases/latest/ over outbound HTTPS. If your Docker host has no internet access, that download fails and /admin and /account both return 404 Not Found.

The documented workaround for air-gapped / restricted-egress deployments is:

  1. Download the WebUI zip out-of-band on a machine that has internet access (grab the zip from github.com/stalwartlabs/webui/releases/latest).
  2. Stage it on an internal HTTPS server that your Docker container can reach (e.g. a local Nginx serving the file, or an object-storage bucket on your LAN).
  3. Update the resourceUrl field on the built-in WebUI Application record to point at that internal URL. You can do this via the JMAP API or via the CLI once the server is running:
    • In the WebUI (if you can get it running first): Settings > Web Applications > edit the record.
    • Via CLI / JMAP x:Application/set with "resourceUrl": "https://your-internal-server/webui.zip".
  4. Optionally, set autoUpdateFrequency to a very large value (e.g. "3650d") so it never tries to phone home again.

The unpackDirectory field on the Application record also lets you control where the bundle is unpacked, so you could even bind-mount a pre-unpacked directory into the container as a volume if you prefer a fully offline approach.

Relevant docs:

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

why can’t simple download an image contain all required assets?

These are separate apps with their own dev cycle and not everybody wants or needs the WebUI. Same goes for the CLI.

no-ai

The maintenancers, can think about this, or say a way to prebuild it myself? thanks