|
| 1 | +# DocOps Box — Docker Compose service definition |
| 2 | +# Edit .env to configure PROJECT_SLUG, image variant, Ruby version, etc. |
| 3 | +# For machine-local overrides, create .env.local (gitignored). |
| 4 | +# See README.adoc for full documentation. |
| 5 | + |
| 6 | +# dxbx CLI settings. These control how dxbx behaves in this project. |
| 7 | +# All keys are optional; the values below are the built-in defaults. |
| 8 | +x-docopsbox: |
| 9 | + dxbx: |
| 10 | + show_commands: true # print the docker/compose command before running it |
| 11 | + show_warnings: true # print non-fatal warnings (e.g. volume, config notices) |
| 12 | + |
| 13 | + |
| 14 | +services: |
| 15 | + docops: |
| 16 | + env_file: |
| 17 | + - .env |
| 18 | + - path: .env.local |
| 19 | + required: false |
| 20 | + # build: |
| 21 | + # # context: .. because this compose file lives in .config/; .. resolves to |
| 22 | + # # the project root where the Dockerfile lives. |
| 23 | + # context: .. |
| 24 | + # dockerfile: Dockerfile |
| 25 | + # args: |
| 26 | + # RUBY_VERSION: ${RUBY_VERSION:-3.3} |
| 27 | + # IMAGE_CONTEXT: ${IMAGE_CONTEXT:-work} |
| 28 | + # ADD_NODEJS: ${ADD_NODEJS:-true} |
| 29 | + # ADD_PYTHON: ${ADD_PYTHON:-true} |
| 30 | + # ADD_PANDOC: ${ADD_PANDOC:-true} |
| 31 | + # ADD_VALE: ${ADD_VALE:-true} |
| 32 | + # ADD_LIBREOFFICE: ${ADD_LIBREOFFICE:-false} |
| 33 | + # HOST_UID: ${HOST_UID:-1000} |
| 34 | + # HOST_GID: ${HOST_GID:-1000} |
| 35 | + image: ${IMAGE_REGISTRY:-docopslab}/box-${IMAGE_VARIANT:-max}:${IMAGE_CONTEXT:-work} |
| 36 | + container_name: docopsbox_${PROJECT_SLUG:-project} |
| 37 | + environment: |
| 38 | + # Passed to entrypoint.sh for UID/GID reconciliation at container startup. |
| 39 | + # On Linux, dxbx sets these automatically from `id -u` / `id -g`. |
| 40 | + # On macOS with Docker Desktop, the VM provides transparent ownership mapping |
| 41 | + # and these can be left unset. |
| 42 | + HOST_UID: ${HOST_UID:-} |
| 43 | + HOST_GID: ${HOST_GID:-} |
| 44 | + RUN_USER: ${RUN_USER:-appuser} |
| 45 | + IMAGE_CONTEXT: ${IMAGE_CONTEXT:-work} |
| 46 | + DOCOPSBOX_IMAGE_ID: ${DOCOPSBOX_IMAGE_ID:-} |
| 47 | + DOCOPSBOX_IMAGE_DIGEST: ${DOCOPSBOX_IMAGE_DIGEST:-} |
| 48 | + volumes: |
| 49 | + # ..:/workspace because this compose file lives in .config/; .. resolves |
| 50 | + # to the project root which is what we want to mount as the workspace. |
| 51 | + # :z applies a shared SELinux label so Fedora/RHEL with SELinux enforcing |
| 52 | + # allows the bind mount. It is a no-op on macOS and Windows/Docker Desktop. |
| 53 | + - ..:/workspace:z |
| 54 | + - docops-shell-history:/commandhistory |
| 55 | + - docops-project-bundle:/usr/local/bundle |
| 56 | + # Per-project Node.js and Python dependency volumes. Named volumes keep |
| 57 | + # platform-native binaries (Linux builds) isolated from the host filesystem |
| 58 | + # and persistent across container restarts without polluting the workspace. |
| 59 | + - docops-project-node:/workspace/node_modules |
| 60 | + - docops-project-python:/opt/venv |
| 61 | + # Shared npm and pip download caches. Mounted at the fixed paths set by |
| 62 | + # npm_config_cache and PIP_CACHE_DIR in the image. Shared across all |
| 63 | + # projects so downloading a package once benefits all local projects. |
| 64 | + - docops-npm-cache:/npm-cache |
| 65 | + - docops-pip-cache:/pip-cache |
| 66 | + working_dir: /workspace |
| 67 | + # tty: true keeps the container alive when docker compose up runs without an |
| 68 | + # interactive terminal (e.g., VS Code Dev Containers). The Dev Containers |
| 69 | + # extension overrides this command, but tty: true is a defensive safeguard. |
| 70 | + tty: true |
| 71 | + command: zsh |
| 72 | + # Uncomment to forward local ports (e.g., Jekyll server): |
| 73 | + # ports: |
| 74 | + # - "4000:4000" |
| 75 | + labels: |
| 76 | + dxbx.managed: "true" |
| 77 | + dxbx.project_slug: ${PROJECT_SLUG:-project} |
| 78 | + |
| 79 | +volumes: |
| 80 | + docops-shell-history: |
| 81 | + # Precious: persists across resets. Only removed by `dxbx reset --full`. |
| 82 | + # external: true tells Compose this volume is not owned by any single project, |
| 83 | + # suppressing the "was created for project X" warning when multiple projects |
| 84 | + # share it. dxbx creates it on first use via `docker volume create`. |
| 85 | + external: true |
| 86 | + name: docops-shell-history |
| 87 | + docops-project-bundle: |
| 88 | + # Disposable: cleared on `dxbx reset`. Rebuilt automatically on next run. |
| 89 | + # The actual Docker volume name embeds PROJECT_SLUG for per-project isolation. |
| 90 | + name: docops-${PROJECT_SLUG:-project}-bundle |
| 91 | + docops-project-node: |
| 92 | + # Disposable: cleared on `dxbx reset`. Rebuilt automatically on next npm install. |
| 93 | + # Named volume keeps Linux node_modules binaries off the host filesystem. |
| 94 | + name: docops-${PROJECT_SLUG:-project}-node |
| 95 | + docops-project-python: |
| 96 | + # Disposable: cleared on `dxbx reset`. Venv is re-bootstrapped on next container start. |
| 97 | + name: docops-${PROJECT_SLUG:-project}-python |
| 98 | + docops-npm-cache: |
| 99 | + # Shared npm download cache. Speeds up `npm install` across all projects. |
| 100 | + # Disposable: safe to delete; npm will re-download packages as needed. |
| 101 | + external: true # non-exclusive per project |
| 102 | + name: docops-npm-cache |
| 103 | + docops-pip-cache: |
| 104 | + # Shared pip download cache. Speeds up `pip install` across all projects. |
| 105 | + # Disposable: safe to delete; pip will re-download packages |
| 106 | + external: true # non-exclusive per project |
| 107 | + name: docops-pip-cache |
0 commit comments