diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..64987aeb8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +{ + "name": "Comp AI", + "image": "mcr.microsoft.com/devcontainers/javascript-node:20", + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {} + }, + "forwardPorts": [3000, 3002, 5432], + "portsAttributes": { + "3000": { + "label": "App", + "onAutoForward": "notify" + }, + "3002": { + "label": "Portal", + "onAutoForward": "notify" + }, + "5432": { + "label": "Postgres", + "onAutoForward": "silent" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "esbenp.prettier-vscode", + "bradlc.vscode-tailwindcss", + "Prisma.prisma", + "oven.bun-vscode" + ] + } + }, + "postCreateCommand": "bash .devcontainer/setup.sh", + "remoteUser": "node" +} \ No newline at end of file diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 000000000..930fb9204 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +echo "Installing Bun..." +npm install -g bun + +echo "Copying .env files..." +if [ ! -f apps/app/.env ] && [ -f apps/app/.env.example ]; then + cp apps/app/.env.example apps/app/.env + echo "Copied apps/app/.env" +fi + +if [ ! -f apps/portal/.env ] && [ -f apps/portal/.env.example ]; then + cp apps/portal/.env.example apps/portal/.env + echo "Copied apps/portal/.env" +fi + +if [ ! -f packages/db/.env ] && [ -f packages/db/.env.example ]; then + cp packages/db/.env.example packages/db/.env + echo "Copied packages/db/.env" +fi + +echo "Installing project dependencies..." +bun install + +echo "Setup complete!"