# --- build stage: compile the Vite app to static files --- FROM oven/bun:1 AS build WORKDIR /app COPY package.json bun.lock ./ COPY packages/demo/package.json packages/demo/ RUN bun install --frozen-lockfile COPY packages/demo packages/demo # Build with a placeholder instead of a real URL. The entrypoint replaces it at # container startup, so the SERVER_URL env controls the relay address at runtime # (no rebuild needed). See demo-entrypoint.sh. ENV VITE_SERVER_URL=__COSMIC_SERVER_URL__ RUN cd packages/demo && bun run build # --- serve stage: hand the built files to nginx --- FROM nginx:alpine COPY --from=build /app/packages/demo/dist /usr/share/nginx/html COPY demo-entrypoint.sh /docker-entrypoint.d/40-cosmic-server-url.sh EXPOSE 80