-
Notifications
You must be signed in to change notification settings - Fork 7
Introduce devcontainer service container based development environment (#705)
#706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bedrich-schindler
wants to merge
16
commits into
master
Choose a base branch
from
task/705
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1ef9f0b
Introduce `devcontainer` service container based development environm…
bedrich-schindler dae197b
!fixup Introduce `devcontainer` service container based development e…
bedrich-schindler cae210f
fixup! !fixup Introduce `devcontainer` service container based develo…
bedrich-schindler 3195ad6
fixup! fixup! !fixup Introduce `devcontainer` service container based…
bedrich-schindler 92e80ca
fixup! fixup! fixup! !fixup Introduce `devcontainer` service containe…
bedrich-schindler 8cf087b
fixup! fixup! fixup! fixup! !fixup Introduce `devcontainer` service c…
bedrich-schindler b0cee5f
fixup! fixup! fixup! fixup! fixup! !fixup Introduce `devcontainer` se…
bedrich-schindler 58cd4e5
fixup! fixup! fixup! fixup! fixup! fixup! !fixup Introduce `devcontai…
bedrich-schindler 1bf514f
fixup! fixup! fixup! fixup! fixup! fixup! fixup! !fixup Introduce `de…
bedrich-schindler c12936f
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! !fixup Introd…
bedrich-schindler 6a3dbc0
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! !fixup…
bedrich-schindler 9a7e831
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
bedrich-schindler cdc0490
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
bedrich-schindler 1cdc6c2
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
bedrich-schindler c98e767
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
bedrich-schindler e51a1da
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
bedrich-schindler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "name": "React UI (${localWorkspaceFolderBasename})", | ||
| "initializeCommand": "bash ./setup.sh", | ||
| "dockerComposeFile": [ | ||
| "../docker-compose.yml" | ||
| ], | ||
| "service": "devcontainer", | ||
| "shutdownAction": "stopCompose", | ||
| "workspaceFolder": "/workspace", | ||
| "forwardPorts": [ | ||
| "docs:8000" | ||
| ], | ||
| "portsAttributes": { | ||
| "docs:8000": { | ||
| "label": "Docs server", | ||
| "protocol": "http", | ||
| "onAutoForward": "openBrowser" | ||
| } | ||
| }, | ||
| "otherPortsAttributes": { | ||
| "onAutoForward": "ignore" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,51 @@ | ||
| ############################### | ||
| # Docker compose configuration # | ||
| ############################### | ||
| ################################ | ||
| # Docker Compose configuration # | ||
| ################################ | ||
|
|
||
| # Host system port where the live documentation is to be made accessible | ||
| COMPOSE_START_PORT=8000 | ||
| # Must match Docker Compose project name used to start the other service containers to allow devcontainer | ||
| # to communicate with them (setup.sh derives this from the directory basename by default) | ||
| COMPOSE_PROJECT_NAME=react-ui | ||
|
bedrich-schindler marked this conversation as resolved.
|
||
|
|
||
| # Host system port where Playwright Component Testing report is to be made accessible | ||
| # Docker compose ports for Docs server instances | ||
| COMPOSE_DOCS_SERVER_PORT=8000 | ||
|
|
||
| # Docker compose ports for Playwright Component Testing report server | ||
| COMPOSE_PLAYWRIGHT_REPORT_PORT=9323 | ||
|
|
||
| # Flag whether the `node` and `docs` service containers should automatically install dependencies, | ||
| # build, and run the application (JavaScript files watcher, docs server) when they start | ||
| COMPOSE_AUTOSTART=false | ||
|
|
||
| # Ownership of the files created in the container | ||
| # ⚠️ [Linux] This needs to be set to the output of `id --user` | ||
| # ⚠️ [MacOS] This needs to be set to 1000 | ||
| COMPOSE_UID=1000 | ||
| # ⚠️ [Linux] This needs to be set to the output of `id --group` | ||
| # ⚠️ [MacOS] This needs to be set to 1000 | ||
| COMPOSE_GID=1000 | ||
|
|
||
| ############################# | ||
| # Devcontainer configuration # | ||
| ############################# | ||
|
bedrich-schindler marked this conversation as resolved.
|
||
|
|
||
| # IDEs automatically mount the host's SSH agent socket into the container | ||
| # Visual Studio Code does this by default, it can be disabled by setting the following variable to true. | ||
| # JetBrains IDEs do not mount this by default, but they can be configured to do so. | ||
| BLOCK_SSH_AUTH_SOCK=false | ||
|
|
||
| # Select your preferred editor and visual (vim, nano) | ||
| EDITOR=vim | ||
| VISUAL=vim | ||
|
|
||
| # Select your preferred shell (/bin/bash, /bin/fish, /bin/zsh) | ||
| SHELL=/bin/bash | ||
|
|
||
| ########################### | ||
| # Playwright configuration # | ||
| ########################### | ||
|
bedrich-schindler marked this conversation as resolved.
|
||
|
|
||
| # Number of workers to use to run Playwright tests | ||
| PW_WORKERS=1 | ||
|
|
||
| # Port used by Playwright Component Testing to serve the test files | ||
| PW_CT_PORT=3100 | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| /coverage | ||
| /docker-compose.yml | ||
| /docker/react_ui_devcontainer_local | ||
| !/docker/react_ui_devcontainer_local/Dockerfile.dist | ||
| /dist | ||
| /node_modules | ||
| /playwright-report/ | ||
| /site | ||
| /src/docs/_assets/generated/* | ||
| /tests/playwright/.temp/ | ||
| .env | ||
| .env.playwright | ||
| statistics.html | ||
| !.gitkeep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| services: | ||
| # This service is responsible for providing the main development environment for developers | ||
| devcontainer: | ||
| hostname: ${COMPOSE_PROJECT_NAME:-react-ui}_devcontainer | ||
| build: | ||
| context: docker/react_ui_devcontainer/ | ||
| dockerfile: Dockerfile | ||
| # Start dependent services before starting the `devcontainer` service to ensure that the necessary environments | ||
| # and tools are available when the `devcontainer` starts. | ||
| depends_on: | ||
| node: | ||
| condition: service_started | ||
| playwright: | ||
| condition: service_started | ||
| docs: | ||
| condition: service_started | ||
| # Run as host UID/GID so files created in mounted volumes are owned correctly on the host. | ||
| # The images use `fixuid` (https://github.com/boxboat/fixuid) to remap the built-in `developer` | ||
| # user to these IDs at startup — the `user:` directive is required for that remap to work. | ||
| # Applied to all services below for the same reason. | ||
| user: ${COMPOSE_UID}:${COMPOSE_GID} | ||
|
bedrich-schindler marked this conversation as resolved.
|
||
| # Keep the container running indefinitely to allow developers to attach to it and use it as their development environment | ||
| command: sleep infinity | ||
|
bedrich-schindler marked this conversation as resolved.
|
||
| # Injects environment variables from the `.env` file into the `devcontainer` service, | ||
| # making them accessible within the container's environment. | ||
| env_file: | ||
| - .env | ||
| environment: | ||
| # This must be set correctly for the `devcontainer` to be able to access the host's Docker daemon, | ||
| # enabling Docker-from-Docker capabilities (e.g., running Docker commands from within the `devcontainer`). | ||
| COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME:-react-ui} | ||
| init: true | ||
| volumes: | ||
| - .:/workspace:z | ||
| # The following volume is used to allow the `devcontainer` to access the host's Docker daemon, | ||
| # enabling Docker-from-Docker capabilities (e.g., running Docker commands from within the `devcontainer`). | ||
| - /var/run/docker.sock:/var/run/docker.sock | ||
| # The following named volumes persist data (e.g. terminal history, AI tools data, etc.) across container restarts. | ||
| # Using separate named volumes (instead of a single volume with subpaths) allows Docker to automatically | ||
| # seed the volume with data from the image on first use. | ||
| - terminal-history:/home/developer/.terminal_history | ||
| - claude-config:/home/developer/.config/claude | ||
| - claude-share:/home/developer/.local/share/claude | ||
| - claude-state:/home/developer/.local/state/claude | ||
| - copilot:/home/developer/.copilot | ||
| - copilot-config:/home/developer/.config/copilot | ||
| - opencode-config:/home/developer/.config/opencode | ||
| - opencode-share:/home/developer/.local/share/opencode | ||
| - opencode-state:/home/developer/.local/state/opencode | ||
|
|
||
| # This service provides Node environment and NPM | ||
| node: | ||
| build: docker/node | ||
| user: ${COMPOSE_UID}:${COMPOSE_GID} | ||
| entrypoint: sh -c 'if [ "$$COMPOSE_AUTOSTART" = "true" ]; then sh scripts/auto-start-node.sh; else sleep infinity; fi' | ||
| env_file: | ||
| - .env | ||
| volumes: | ||
| - .:/workspace:z | ||
|
|
||
| # This service provides Playwright environment and tools for browser automation and testing | ||
| playwright: | ||
| build: docker/playwright | ||
| user: ${COMPOSE_UID}:${COMPOSE_GID} | ||
| command: sleep infinity | ||
| env_file: | ||
| - .env | ||
| ports: | ||
| - ${COMPOSE_PLAYWRIGHT_REPORT_PORT}:9323 | ||
| volumes: | ||
| - .:/workspace:z | ||
|
|
||
| # This provides server for documentation | ||
| docs: | ||
| build: docker/mkdocs | ||
| user: ${COMPOSE_UID}:${COMPOSE_GID} | ||
| entrypoint: sh -c 'if [ "$$COMPOSE_AUTOSTART" = "true" ]; then sh scripts/auto-start-mkdocs.sh; else sleep infinity; fi' | ||
| env_file: | ||
| - .env | ||
| ports: | ||
| - ${COMPOSE_DOCS_SERVER_PORT}:8000 | ||
| volumes: | ||
| - .:/workspace:z | ||
|
|
||
| volumes: | ||
| # The following volumes are used to persist data (e.g. terminal history, AI tools data, etc.) across container restarts | ||
| terminal-history: | ||
| claude-config: | ||
| claude-share: | ||
| claude-state: | ||
| copilot: | ||
| copilot-config: | ||
| opencode-config: | ||
| opencode-share: | ||
| opencode-state: | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| services: | ||
| # This service is responsible for providing the main development environment for developers | ||
| devcontainer: | ||
| extends: | ||
| file: docker-compose.base.yml | ||
| service: devcontainer | ||
| # Use `build` when you want to customize the devcontainer using `docker/react_ui_devcontainer_local/Dockerfile` | ||
| # build: | ||
| # context: ./docker/react_ui_devcontainer_local/ | ||
| # dockerfile: Dockerfile | ||
| # Use `image` when you want to use the default devcontainer | ||
| image: react-ui_devcontainer | ||
|
|
||
| # This service provides Node environment and NPM | ||
| node: | ||
| extends: | ||
| file: docker-compose.base.yml | ||
| service: node | ||
|
|
||
| # This service provides Playwright environment and tools for browser automation and testing | ||
| playwright: | ||
| extends: | ||
| file: docker-compose.base.yml | ||
| service: playwright | ||
|
|
||
| # This provides server for documentation | ||
| docs: | ||
| extends: | ||
| file: docker-compose.base.yml | ||
| service: docs | ||
|
|
||
| volumes: | ||
| # The following volumes are used to persist data (e.g. terminal history, AI tools data, etc.) across container restarts | ||
| terminal-history: | ||
| claude-config: | ||
| claude-share: | ||
| claude-state: | ||
| copilot: | ||
| copilot-config: | ||
| opencode-config: | ||
| opencode-share: | ||
| opencode-state: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
| trap 'echo "Failed to build Docker images"; exit 1' ERR | ||
|
bedrich-schindler marked this conversation as resolved.
|
||
|
|
||
| cd "$(dirname "$0")" | ||
|
|
||
| echo "Building Docker images..." | ||
|
|
||
| if [ ! -f ../.env ]; then | ||
| echo "Error: .env file not found in the project root" | ||
| exit 1 | ||
| fi | ||
|
|
||
| PROJECT_NAME=$(grep -E '^COMPOSE_PROJECT_NAME=' ../.env | cut -d '=' -f 2-) | ||
| PROJECT_DEVCONTAINER_IMAGE="${PROJECT_NAME}_devcontainer" | ||
|
|
||
| echo "Building Docker image $PROJECT_DEVCONTAINER_IMAGE..." | ||
|
bedrich-schindler marked this conversation as resolved.
|
||
| docker build -t "$PROJECT_DEVCONTAINER_IMAGE" -f ./react_ui_devcontainer/Dockerfile ./react_ui_devcontainer/ | ||
|
bedrich-schindler marked this conversation as resolved.
|
||
|
|
||
| cd .. | ||
|
|
||
| echo "Building project Docker images using docker-compose..." | ||
| docker compose build | ||
|
|
||
|
bedrich-schindler marked this conversation as resolved.
|
||
| echo "All Docker images built successfully!" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| FROM squidfunk/mkdocs-material:9 | ||
| # We freezed the version of mkdocs-material to prevent issue with live reload | ||
| # See <https://github.com/squidfunk/mkdocs-material/issues/8478> | ||
| FROM squidfunk/mkdocs-material:9.6.20 | ||
| RUN mkdir /workspace | ||
| WORKDIR /workspace |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.