|
| 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 (git-ignored). |
| 4 | +# See README.adoc for full documentation. |
| 5 | + |
| 6 | +name: docops-${PROJECT_SLUG:-project} |
| 7 | + |
| 8 | +services: |
| 9 | + docops: |
| 10 | + env_file: |
| 11 | + - .env |
| 12 | + - path: .env.local |
| 13 | + required: false |
| 14 | + image: ${IMAGE_REGISTRY:-docopslab}/box-${IMAGE_VARIANT:-max}:${IMAGE_TAG:-work} |
| 15 | + container_name: docopsbox_${PROJECT_SLUG:-project} |
| 16 | + environment: |
| 17 | + # Passed to entrypoint.sh for UID/GID reconciliation at container startup. |
| 18 | + # On Linux, dxbx sets these automatically from `id -u` / `id -g`. |
| 19 | + # On macOS with Docker Desktop, the VM provides transparent ownership mapping |
| 20 | + # and these can be left unset. |
| 21 | + HOST_UID: ${HOST_UID:-} |
| 22 | + HOST_GID: ${HOST_GID:-} |
| 23 | + RUN_USER: ${RUN_USER:-appuser} |
| 24 | + IMAGE_CONTEXT: ${IMAGE_CONTEXT:-work} |
| 25 | + DOCOPSBOX_IMAGE_ID: ${DOCOPSBOX_IMAGE_ID:-} |
| 26 | + DOCOPSBOX_IMAGE_DIGEST: ${DOCOPSBOX_IMAGE_DIGEST:-} |
| 27 | + volumes: |
| 28 | + # ..:/workspace because this compose file lives in .config/; .. resolves |
| 29 | + # to the project root which is what we want to mount as the workspace. |
| 30 | + # :z applies a shared SELinux label so Fedora/RHEL with SELinux enforcing |
| 31 | + # allows the bind mount. It is a no-op on macOS and Windows/Docker Desktop. |
| 32 | + - ..:/workspace:z |
| 33 | + - docops-shell-history:/commandhistory |
| 34 | + - docops-project-bundle:/usr/local/bundle |
| 35 | + # Per-project Node.js and Python dependency volumes. Named volumes keep |
| 36 | + # platform-native binaries (Linux builds) isolated from the host filesystem |
| 37 | + # and persistent across container restarts without polluting the workspace. |
| 38 | + - docops-project-node:/workspace/node_modules |
| 39 | + - docops-project-python:/opt/venv |
| 40 | + # Shared npm and pip download caches. Mounted at the fixed paths set by |
| 41 | + # npm_config_cache and PIP_CACHE_DIR in the image. Shared across all |
| 42 | + # projects so downloading a package once benefits all local projects. |
| 43 | + - docops-npm-cache:/npm-cache |
| 44 | + - docops-pip-cache:/pip-cache |
| 45 | + working_dir: /workspace |
| 46 | + # tty: true keeps the container alive when docker compose up runs without an |
| 47 | + # interactive terminal (e.g., VS Code Dev Containers). The Dev Containers |
| 48 | + # extension overrides this command, but tty: true is a defensive safeguard. |
| 49 | + tty: true |
| 50 | + command: zsh |
| 51 | + # Uncomment to forward local ports (e.g., Jekyll server): |
| 52 | + # ports: |
| 53 | + # - "4000:4000" |
| 54 | + labels: |
| 55 | + dxbx.managed: "true" |
| 56 | + dxbx.project_slug: ${PROJECT_SLUG:-project} |
| 57 | + |
| 58 | +volumes: |
| 59 | + # Volumes are local only; they are not pushed/pulled with Git or Docker images. |
| 60 | + docops-shell-history: # Persists across resets. |
| 61 | + external: true # shared across projects, locally only |
| 62 | + name: docops-shell-history |
| 63 | + docops-project-bundle: |
| 64 | + name: docops-${PROJECT_SLUG:-project}-bundle |
| 65 | + docops-project-node: |
| 66 | + name: docops-${PROJECT_SLUG:-project}-node |
| 67 | + docops-project-python: |
| 68 | + name: docops-${PROJECT_SLUG:-project}-python |
| 69 | + docops-npm-cache: |
| 70 | + external: true # non-exclusive per project |
| 71 | + name: docops-npm-cache |
| 72 | + docops-pip-cache: |
| 73 | + external: true # non-exclusive per project |
| 74 | + name: docops-pip-cache |
0 commit comments