From 0f3db459cbe0beda72500787b60b501ec94cf2e7 Mon Sep 17 00:00:00 2001 From: Mythie Date: Sat, 9 Sep 2023 04:38:37 +0000 Subject: [PATCH] feat: add devcontainer --- .devcontainer/devcontainer.json | 20 ++++++++++++++++++++ .devcontainer/on-create.sh | 21 +++++++++++++++++++++ package.json | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/on-create.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..59a318b7f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "Documenso", + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "latest", + "enableNonRootDocker": "true", + "moby": "true" + }, + "ghcr.io/devcontainers/features/node:1": {} + }, + "onCreateCommand": "./.devcontainer/on-create.sh", + "forwardPorts": [ + 3000, + 54320, + 9000, + 2500, + 1100 + ] +} diff --git a/.devcontainer/on-create.sh b/.devcontainer/on-create.sh new file mode 100755 index 000000000..2d823e864 --- /dev/null +++ b/.devcontainer/on-create.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Start the database and mailserver +docker compose -f ./docker/compose-without-app.yml up -d + +# Install dependencies +npm install + +# Copy the env file +cp .env.example .env + +# Source the env file, export the variables +set -a +source .env +set +a + +# Run the migrations +npm run -w @documenso/prisma prisma:migrate-dev + +# Start the app +npm run dev diff --git a/package.json b/package.json index 72fa9b02c..c8f221ef5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "scripts": { "build": "turbo run build", - "dev": "turbo run dev --filter=@documenso/{web,marketing}", + "dev": "turbo run dev --filter=@documenso/web --filter=@documenso/marketing", "start": "cd apps && cd web && next start", "lint": "turbo run lint", "format": "prettier --write \"**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts,mdx}\"",