diff --git a/.devcontainer/devcontainer.json b/.devcontainer/app/devcontainer.json similarity index 85% rename from .devcontainer/devcontainer.json rename to .devcontainer/app/devcontainer.json index b0ebb42faec..1f50f635303 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/app/devcontainer.json @@ -2,8 +2,8 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu { "name": "GROWI-Dev", - "dockerComposeFile": "compose.yml", - "service": "node", + "dockerComposeFile": "../compose.yml", + "service": "app", "workspaceFolder": "/workspace/growi", "features": { @@ -16,7 +16,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "/bin/bash ./.devcontainer/postCreateCommand.sh", + "postCreateCommand": "/bin/bash ./.devcontainer/app/postCreateCommand.sh", // Configure tool-specific properties. "customizations": { @@ -37,6 +37,9 @@ "vitest.explorer", "ms-playwright.playwright" ], + "settings": { + "terminal.integrated.defaultProfile.linux": "bash" + } } }, diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/app/postCreateCommand.sh similarity index 100% rename from .devcontainer/postCreateCommand.sh rename to .devcontainer/app/postCreateCommand.sh diff --git a/.devcontainer/compose.yml b/.devcontainer/compose.yml index f1c0a57a4f2..8d99378a9c3 100644 --- a/.devcontainer/compose.yml +++ b/.devcontainer/compose.yml @@ -1,5 +1,5 @@ services: - node: + app: image: mcr.microsoft.com/devcontainers/base:ubuntu volumes: - ..:/workspace/growi:delegated @@ -7,6 +7,7 @@ services: - node_modules:/workspace/growi/node_modules - buildcache_app:/workspace/growi/apps/app/.next - ../../growi-docker-compose:/workspace/growi-docker-compose:delegated + - page_bulk_export_tmp:/tmp/page-bulk-export tty: true mongo: @@ -40,7 +41,18 @@ services: - /usr/share/elasticsearch/data - ../../growi-docker-compose/elasticsearch/v8/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml + pdf-converter: + # enabling devcontainer 'features' was not working for secondary devcontainer (https://github.com/devcontainers/features/issues/1175) + image: mcr.microsoft.com/vscode/devcontainers/javascript-node:0-20 + volumes: + - ..:/workspace/growi:delegated + - pnpm-store:/workspace/growi/.pnpm-store + - node_modules:/workspace/growi/node_modules + - page_bulk_export_tmp:/tmp/page-bulk-export + tty: true + volumes: pnpm-store: node_modules: buildcache_app: + page_bulk_export_tmp: diff --git a/.devcontainer/pdf-converter/devcontainer.json b/.devcontainer/pdf-converter/devcontainer.json new file mode 100644 index 00000000000..0804178f27f --- /dev/null +++ b/.devcontainer/pdf-converter/devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "GROWI-PDF-Converter", + "dockerComposeFile": "../compose.yml", + "service": "pdf-converter", + "workspaceFolder": "/workspace/growi", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "/bin/bash ./.devcontainer/pdf-converter/postCreateCommand.sh", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "dbaeumer.vscode-eslint", + "mhutchie.git-graph", + "eamodio.gitlens" + ], + "settings": { + "terminal.integrated.defaultProfile.linux": "bash" + } + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/pdf-converter/postCreateCommand.sh b/.devcontainer/pdf-converter/postCreateCommand.sh new file mode 100644 index 00000000000..a1cb50d19a5 --- /dev/null +++ b/.devcontainer/pdf-converter/postCreateCommand.sh @@ -0,0 +1,17 @@ +# Instal additional packages +sudo apt update +sudo apt-get install -y --no-install-recommends \ + chromium locales fonts-ipafont fonts-ipaexfont fonts-ipafont-gothic fonts-ipafont-mincho +sudo apt-get clean -y + +# Setup pnpm +SHELL=bash pnpm setup +eval "$(cat /home/node/.bashrc)" +# Update pnpm +pnpm i -g pnpm + +# Install turbo +pnpm install turbo --global + +# Install dependencies +turbo run bootstrap diff --git a/apps/pdf-converter/package.json b/apps/pdf-converter/package.json index b1ea5398b3e..f1035e0b6a1 100644 --- a/apps/pdf-converter/package.json +++ b/apps/pdf-converter/package.json @@ -6,7 +6,7 @@ "license": "MIT", "private": true, "scripts": { - "dev:pdf-converter": "nodemon --watch \"src/**/*.ts\" --ignore \"node_modules/**/*\" --exec ts-node -r \"dotenv-flow/config\" src/index.ts", + "dev": "nodemon --watch \"src/**/*.ts\" --ignore \"node_modules/**/*\" --exec ts-node -r \"dotenv-flow/config\" src/index.ts", "lint": "pnpm eslint **/*.{js,ts}", "gen:client-code": "tsed run generate-swagger --output ./specs && orval", "build": "pnpm gen:client-code && tsc -p tsconfig.build.json"