Skip to content

Commit d35a782

Browse files
authored
java + node devcontainer (#1509)
Update the devcontainer configuration to use both java and node.js. I also changed the cf cli installation to brew because the cf-deploy plugin installation currently does not work on arm64 (-> m4 macs).
1 parent a2acd8b commit d35a782

6 files changed

Lines changed: 76 additions & 28 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"id": "cds-dk",
3+
"version": "1.0.0",
4+
"name": "cds-dk",
5+
"description": "Install @sap/cds-dk (via npm)",
6+
7+
"options": {
8+
9+
"version": {
10+
"type": "string",
11+
"proposals": [
12+
"^9",
13+
"^8"
14+
],
15+
"default": "latest",
16+
"description": "Select the @sap/cds-dk version"
17+
}
18+
},
19+
20+
"dependsOn": {
21+
"ghcr.io/devcontainers/features/node:1": { }
22+
}
23+
}

.devcontainer/cds-dk/install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -e
3+
4+
export VERSION_SPECIFIER="${VERSION:+@${VERSION}}"
5+
6+
. ${NVM_DIR}/nvm.sh
7+
8+
npm i -g @sap/cds-dk${VERSION_SPECIFIER}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"id": "cf-deploy",
3+
"version": "1.0.1",
4+
"name": "cf-deploy",
5+
"description": "Install tooling for deploying to Cloud Foundry",
6+
7+
"dependsOn": {
8+
"ghcr.io/devcontainers/features/node:1": { }
9+
}
10+
}

.devcontainer/cf-deploy/install.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Homebrew
5+
if ! type brew >/dev/null 2>&1; then
6+
NONINTERACTIVE=1 su vscode -s /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
7+
8+
echo >> /home/vscode/.bashrc
9+
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/vscode/.bashrc
10+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
11+
fi
12+
13+
su vscode -s /bin/bash -c "brew install cloudfoundry/tap/cf-cli@8"
14+
su vscode -s /bin/bash -c "cf install-plugin -f multiapps"
15+
16+
npm i -g mbt

.devcontainer/devcontainer.json

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
1+
// For format details, see https://aka.ms/devcontainer.json
32
{
4-
"name": "Node.js & TypeScript",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"build": {
7-
"dockerfile": "Dockerfile"
8-
},
3+
"name": "CAP Node.js & TypeScript & Java",
4+
"image": "mcr.microsoft.com/devcontainers/base:debian",
5+
96
// Features to add to the dev container. More info: https://containers.dev/features.
10-
// "features": {},
11-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
12-
// "forwardPorts": [],
7+
"features": {
8+
"ghcr.io/devcontainers/features/node:1": {},
9+
"ghcr.io/devcontainers-extra/features/typescript:2": {},
10+
"ghcr.io/devcontainers/features/java:1": {
11+
"version": "21",
12+
"jdkDistro": "sapmchn",
13+
"installMaven": "true"
14+
},
15+
16+
"./cds-dk": {},
17+
18+
"./cf-deploy": {}
19+
},
20+
1321
// Use 'postCreateCommand' to run commands after the container is created.
1422
"postCreateCommand": "npm install"
15-
// Configure tool-specific properties.
16-
// "customizations": {},
17-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
18-
// "remoteUser": "root"
23+
1924
}

0 commit comments

Comments
 (0)