Development Containers (CAP): Unterschied zwischen den Versionen
Aus MattWiki
Matt (Diskussion | Beiträge) K (Matt verschob die Seite Development Containers nach Development Containers (CAP), ohne dabei eine Weiterleitung anzulegen) |
Matt (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
This article describes approaches for developing of SAP Cloud Application Programming Model (CAP) by utilizing development containers. | |||
== Docker Desktop == | == Docker Desktop == | ||
This following approach is based on: https://containers.dev/ | This following approach is based on: | ||
* https://containers.dev/ | |||
* https://qmacro.org/blog/posts/2024/01/15/developing-cap-in-containers-three-ways/ | |||
It requires a local installation of Docker Desktop. | |||
=== Configuration === | === Configuration === | ||
Zeile 10: | Zeile 14: | ||
|-- Dockerfile | |-- Dockerfile | ||
`-- devcontainer.json | `-- devcontainer.json | ||
Contents of | Contents of Dockerfile: <syntaxhighlight lang="dockerfile" line="1"> | ||
# syntax=docker/dockerfile:1 | |||
ARG VARIANT="20" | |||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} | |||
# Install some generally useful tools | |||
RUN apt-get update && apt-get -y install --no-install-recommends curl git sqlite3 | |||
# Install SAP CAP SDK globally | |||
USER node | |||
RUN npm install -g @sap/cds-dk | |||
WORKDIR /home/node | |||
</syntaxhighlight>Contents of devcontainer.json<syntaxhighlight lang="json" line="1"> | |||
{ | |||
"name": "Portfolio Manager", | |||
"build": { | |||
"dockerfile": "Dockerfile", | |||
"args": { "VARIANT": "20" } | |||
}, | |||
"customizations": { | |||
"vscode": { | |||
"extensions": [ | |||
"sapse.vscode-cds", | |||
"dbaeumer.vscode-eslint", | |||
"humao.rest-client", | |||
"qwtel.sqlite-viewer", | |||
"mechatroner.rainbow-csv" | |||
] | |||
} | |||
}, | |||
"forwardPorts": [ 4004 ], | |||
"remoteUser": "node" | |||
} | |||
</syntaxhighlight> | |||
== WSL2 / Windows Subsystem for Linux == | == WSL2 / Windows Subsystem for Linux == | ||
For installation and management of WSL see [[Windows Subsystem For Linux (WSL)]] | For installation and management of WSL see [[Windows Subsystem For Linux (WSL)]] | ||
[[Kategorie:Development]] | [[Kategorie:Development]] | ||
[[Kategorie:SAP]] | |||
[[Kategorie:JavaScript]] |
Version vom 18. August 2024, 17:53 Uhr
This article describes approaches for developing of SAP Cloud Application Programming Model (CAP) by utilizing development containers.
Docker Desktop
This following approach is based on:
- https://containers.dev/
- https://qmacro.org/blog/posts/2024/01/15/developing-cap-in-containers-three-ways/
It requires a local installation of Docker Desktop.
Configuration
Create a subfolder .devcontainer with the following files
.devcontainer |-- Dockerfile `-- devcontainer.json
Contents of Dockerfile:
# syntax=docker/dockerfile:1
ARG VARIANT="20"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
# Install some generally useful tools
RUN apt-get update && apt-get -y install --no-install-recommends curl git sqlite3
# Install SAP CAP SDK globally
USER node
RUN npm install -g @sap/cds-dk
WORKDIR /home/node
Contents of devcontainer.json
{
"name": "Portfolio Manager",
"build": {
"dockerfile": "Dockerfile",
"args": { "VARIANT": "20" }
},
"customizations": {
"vscode": {
"extensions": [
"sapse.vscode-cds",
"dbaeumer.vscode-eslint",
"humao.rest-client",
"qwtel.sqlite-viewer",
"mechatroner.rainbow-csv"
]
}
},
"forwardPorts": [ 4004 ],
"remoteUser": "node"
}
WSL2 / Windows Subsystem for Linux
For installation and management of WSL see Windows Subsystem For Linux (WSL)