From a34913efc7d428ede89b6189fc016f4ef24311d7 Mon Sep 17 00:00:00 2001 From: Dar Malovani Date: Tue, 23 Jan 2024 15:39:21 +0200 Subject: [PATCH] feat: add java dev container (#42) --- .devcontainer/devcontainer.json | 42 ------------------- .devcontainer/open_port.sh | 29 ------------- .devcontainer/setup.sh | 9 ---- .../java/.devcontainer/devcontainer.json | 4 ++ .../node/.devcontainer/devcontainer.json | 4 ++ .../python/.devcontainer/devcontainer.json | 4 ++ .../rails/.devcontainer/devcontainer.json | 4 ++ readme.md | 6 +-- 8 files changed, 19 insertions(+), 83 deletions(-) delete mode 100644 .devcontainer/devcontainer.json delete mode 100755 .devcontainer/open_port.sh create mode 100644 .framework/java/.devcontainer/devcontainer.json create mode 100644 .framework/node/.devcontainer/devcontainer.json create mode 100644 .framework/python/.devcontainer/devcontainer.json create mode 100644 .framework/rails/.devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 5b09ae35..00000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "Anythink Development Container", - "image": "public.ecr.aws/v0a2l7y2/wilco/anythink-devcontainer:latest", - "forwardPorts": [3000, 3001, 5433, 27017], - "portsAttributes": { - "3000": { - "label": "Backend", - "elevateIfNeeded": true, - "requireLocalPort": true, - "onAutoForward": "silent" - }, - "3001": { - "label": "Frontend", - "elevateIfNeeded": true, - "requireLocalPort": true, - "onAutoForward": "silent" - }, - "5433": { - "label": "Database", - "elevateIfNeeded": true, - "requireLocalPort": true, - "onAutoForward": "silent" - }, - "27017": { - "label": "Database", - "elevateIfNeeded": true, - "requireLocalPort": true, - "onAutoForward": "silent" - } - }, - "postStartCommand": "bash -c .devcontainer/setup.sh", - - "settings": { - "extensions.ignoreRecommendations": true, - "workbench.startupEditor": "none", - "workbench.colorTheme": "Visual Studio Dark", - "workbench.colorCustomizations": {}, - "workbench.welcomePage.walkthroughs.openOnInstall": false, - "workbench.welcomePage.experimental.videoTutorials": "off", - "github.codespaces.defaultExtensions": [] - } -} diff --git a/.devcontainer/open_port.sh b/.devcontainer/open_port.sh deleted file mode 100755 index 73587698..00000000 --- a/.devcontainer/open_port.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -RETRY_COUNT=3 -RETRY_INTERVAL=5 -TARGET_PORTS=("3000" "3001") - -sleep 5 - -for port in "${TARGET_PORTS[@]}"; do - for ((try = 1; try <= RETRY_COUNT; try++)); do - echo "Attempt $try: Making port $port public." - - gh codespace ports visibility $port:public -c $CODESPACE_NAME - sleep 1 - - ports_json=$(gh codespace ports -c $CODESPACE_NAME --json label,sourcePort,visibility) - visibility=$(echo "$ports_json" | jq -r ".[] | select(.sourcePort == $port) | .visibility") - - if [ "$visibility" == "public" ]; then - echo "Port $port is now public." - break - elif [ $try -lt $RETRY_COUNT ]; then - echo "Port $port is still not public. Retrying in $RETRY_INTERVAL seconds..." - sleep $RETRY_INTERVAL - else - echo "Failed to make port $port public after $RETRY_COUNT attempts." - fi - done -done diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 6e7ed6d5..a6787ec8 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -11,15 +11,6 @@ echo "export CODESPACE_BACKEND_HOST=\"${CODESPACE_BACKEND_HOST}\"" >> ~/.bashrc echo "export CODESPACE_BACKEND_URL=\"${CODESPACE_BACKEND_URL}\"" >> ~/.bashrc echo "export CODESPACE_WDS_SOCKET_PORT=443" >> ~/.bashrc - -# Change backend port visibility to public -echo "(&>/dev/null .devcontainer/open_port.sh &)" >> ~/.bashrc - - # Export welcome prompt in bash: echo "printf \"\n\n☁️☁️☁️️ Anythink: Develop in the Cloud ☁️☁️☁️\n\"" >> ~/.bashrc -echo "printf \"\n=============================================\n\"" >> ~/.bashrc -echo "gh codespace ports -c $CODESPACE_NAME" >> ~/.bashrc -echo "printf \"=============================================\n\"" >> ~/.bashrc -echo "printf \"(Once docker-compose is up and running, you can access the frontend and backend using the above urls)\n\"" >> ~/.bashrc echo "printf \"\n\x1b[31m \x1b[1m👉 Type: \\\`docker compose up\\\` to run the project. 👈\n\n\"" >> ~/.bashrc diff --git a/.framework/java/.devcontainer/devcontainer.json b/.framework/java/.devcontainer/devcontainer.json new file mode 100644 index 00000000..5e6dee50 --- /dev/null +++ b/.framework/java/.devcontainer/devcontainer.json @@ -0,0 +1,4 @@ +{ + "name": "Anythink Development Container", + "image": "public.ecr.aws/v0a2l7y2/wilco/anythink-devcontainer-java:latest" +} diff --git a/.framework/node/.devcontainer/devcontainer.json b/.framework/node/.devcontainer/devcontainer.json new file mode 100644 index 00000000..171e2d2a --- /dev/null +++ b/.framework/node/.devcontainer/devcontainer.json @@ -0,0 +1,4 @@ +{ + "name": "Anythink Development Container", + "image": "public.ecr.aws/v0a2l7y2/wilco/anythink-devcontainer:latest" +} diff --git a/.framework/python/.devcontainer/devcontainer.json b/.framework/python/.devcontainer/devcontainer.json new file mode 100644 index 00000000..171e2d2a --- /dev/null +++ b/.framework/python/.devcontainer/devcontainer.json @@ -0,0 +1,4 @@ +{ + "name": "Anythink Development Container", + "image": "public.ecr.aws/v0a2l7y2/wilco/anythink-devcontainer:latest" +} diff --git a/.framework/rails/.devcontainer/devcontainer.json b/.framework/rails/.devcontainer/devcontainer.json new file mode 100644 index 00000000..171e2d2a --- /dev/null +++ b/.framework/rails/.devcontainer/devcontainer.json @@ -0,0 +1,4 @@ +{ + "name": "Anythink Development Container", + "image": "public.ecr.aws/v0a2l7y2/wilco/anythink-devcontainer:latest" +} diff --git a/readme.md b/readme.md index 098e1779..f587abe8 100644 --- a/readme.md +++ b/readme.md @@ -11,11 +11,11 @@ When implementing a new feature or fixing a bug, please create a new pull reques ## How to run in dev mode? ### Using Codespace -1. run `docker-compose up` +1. run `docker compose up` ### On your local machine 1. [Install Docker](https://docs.docker.com/get-docker/) 2. [Install Docker Compose](https://docs.docker.com/compose/install/) -3. Run `docker-compose up`. +3. Run `docker compose up`. ## Tests -Documentation about running the End to End test can be found under the `/tests` directory \ No newline at end of file +Documentation about running the End to End test can be found under the `/tests` directory