Files
cms-plugins/.ddev/docker-compose.emdash.yaml
Oleks cd2a663935 ddev bootstrap: make app/.env optional, add .env.example
Fresh clones errored out on `ddev start` because the compose file's
env_file: pointed at app/.env (gitignored). No env vars are actually
required by the code — STATE_DIR is the only one and has a default.

- Switch env_file to the path:+required:false form (Docker Compose
  2.24+; bundled with DDEV) so missing app/.env is non-fatal.
- Commit app/.env.example as documentation for contributors who do
  need overrides.
2026-05-20 14:13:38 +03:00

52 lines
1.7 KiB
YAML

# Development container for the emdash app. Bind-mounts ../app from
# the host and runs `npx emdash dev` so source edits hot-reload. The
# production image is built separately from the root Dockerfile and
# consumed by deploy/helm/ — DDEV is *not* a prod-parity smoke test.
services:
emdash:
container_name: ddev-${DDEV_SITENAME}-emdash
image: node:22-bookworm-slim
working_dir: /app
restart: "no"
expose:
- "4321"
# Optional so a fresh clone boots without manual prep. Contributors
# who need overrides can `cp app/.env.example app/.env` and edit.
env_file:
- path: ../app/.env
required: false
environment:
HOST: "0.0.0.0"
PORT: "4321"
NODE_ENV: "development"
EMDASH_ALLOWED_ORIGINS: "https://cms-plugins.ddev.site"
EMDASH_SITE_URL: "https://cms-plugins.ddev.site"
volumes:
- ../app:/app:cached
# Anonymous-ish named volume for node_modules so the host's
# (possibly empty / wrong-arch) directory doesn't shadow what
# the container installs.
- emdash-node-modules:/app/node_modules
command:
- sh
- -c
- |
set -eu
if [ ! -d node_modules ] || [ -z "$$(ls -A node_modules 2>/dev/null)" ]; then
echo "[emdash] installing deps"
apt-get update && apt-get install -y --no-install-recommends python3 make g++ ca-certificates >/dev/null
npm install
fi
if [ ! -f data.db ]; then
echo "[emdash] running emdash init"
node_modules/.bin/emdash init
fi
exec npx emdash dev
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
volumes:
emdash-node-modules: