|
| 1 | +services: |
| 2 | + # This service is responsible for providing the main development environment for developers |
| 3 | + devcontainer: |
| 4 | + hostname: ${COMPOSE_PROJECT_NAME:-react-ui}_devcontainer |
| 5 | + build: |
| 6 | + context: docker/react_ui_devcontainer/ |
| 7 | + dockerfile: Dockerfile |
| 8 | + # Start dependent services before starting the `devcontainer` service to ensure that the necessary environments |
| 9 | + # and tools are available when the `devcontainer` starts. |
| 10 | + depends_on: |
| 11 | + node: |
| 12 | + condition: service_started |
| 13 | + playwright: |
| 14 | + condition: service_started |
| 15 | + docs: |
| 16 | + condition: service_started |
| 17 | + # Run as host UID/GID so files created in mounted volumes are owned correctly on the host. |
| 18 | + # The images use `fixuid` (https://github.com/boxboat/fixuid) to remap the built-in `developer` |
| 19 | + # user to these IDs at startup — the `user:` directive is required for that remap to work. |
| 20 | + # Applied to all services below for the same reason. |
| 21 | + user: ${COMPOSE_UID}:${COMPOSE_GID} |
| 22 | + # Keep the container running indefinitely to allow developers to attach to it and use it as their development environment |
| 23 | + command: sleep infinity |
| 24 | + # Injects environment variables from the `.env` file into the `devcontainer` service, |
| 25 | + # making them accessible within the container's environment. |
| 26 | + env_file: |
| 27 | + - .env |
| 28 | + environment: |
| 29 | + # This must be set correctly for the `devcontainer` to be able to access the host's Docker daemon, |
| 30 | + # enabling Docker-from-Docker capabilities (e.g., running Docker commands from within the `devcontainer`). |
| 31 | + COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME:-react-ui} |
| 32 | + init: true |
| 33 | + volumes: |
| 34 | + - .:/workspace:z |
| 35 | + # The following volume is used to allow the `devcontainer` to access the host's Docker daemon, |
| 36 | + # enabling Docker-from-Docker capabilities (e.g., running Docker commands from within the `devcontainer`). |
| 37 | + - /var/run/docker.sock:/var/run/docker.sock |
| 38 | + # The following named volumes persist data (e.g. terminal history, AI tools data, etc.) across container restarts. |
| 39 | + # Using separate named volumes (instead of a single volume with subpaths) allows Docker to automatically |
| 40 | + # seed the volume with data from the image on first use. |
| 41 | + - terminal-history:/home/developer/.terminal_history |
| 42 | + - claude-config:/home/developer/.config/claude |
| 43 | + - claude-state:/home/developer/.local/state/claude |
| 44 | + - copilot:/home/developer/.copilot |
| 45 | + - copilot-config:/home/developer/.config/copilot |
| 46 | + - opencode-config:/home/developer/.config/opencode |
| 47 | + - opencode-share:/home/developer/.local/share/opencode |
| 48 | + - opencode-state:/home/developer/.local/state/opencode |
| 49 | + |
| 50 | + # This service provides Node environment and NPM |
| 51 | + node: |
| 52 | + build: docker/node |
| 53 | + user: ${COMPOSE_UID}:${COMPOSE_GID} |
| 54 | + entrypoint: sh -c 'if [ "$$COMPOSE_AUTOSTART" = "true" ]; then sh scripts/auto-start-node.sh; else sleep infinity; fi' |
| 55 | + env_file: |
| 56 | + - .env |
| 57 | + volumes: |
| 58 | + - .:/workspace:z |
| 59 | + |
| 60 | + # This service provides Playwright environment and tools for browser automation and testing |
| 61 | + playwright: |
| 62 | + build: docker/playwright |
| 63 | + user: ${COMPOSE_UID}:${COMPOSE_GID} |
| 64 | + command: sleep infinity |
| 65 | + env_file: |
| 66 | + - .env |
| 67 | + ports: |
| 68 | + - ${COMPOSE_PLAYWRIGHT_REPORT_PORT}:9323 |
| 69 | + volumes: |
| 70 | + - .:/workspace:z |
| 71 | + |
| 72 | + # This provides server for documentation |
| 73 | + docs: |
| 74 | + build: docker/mkdocs |
| 75 | + user: ${COMPOSE_UID}:${COMPOSE_GID} |
| 76 | + entrypoint: sh -c 'if [ "$$COMPOSE_AUTOSTART" = "true" ]; then sh scripts/auto-start-mkdocs.sh; else sleep infinity; fi' |
| 77 | + env_file: |
| 78 | + - .env |
| 79 | + ports: |
| 80 | + - ${COMPOSE_DOCS_SERVER_PORT}:8000 |
| 81 | + volumes: |
| 82 | + - .:/workspace:z |
| 83 | + |
| 84 | +volumes: |
| 85 | + # The following volumes are used to persist data (e.g. terminal history, AI tools data, etc.) across container restarts |
| 86 | + terminal-history: |
| 87 | + claude-config: |
| 88 | + claude-state: |
| 89 | + copilot: |
| 90 | + copilot-config: |
| 91 | + opencode-config: |
| 92 | + opencode-share: |
| 93 | + opencode-state: |
0 commit comments