Skip to content

Commit

Permalink
docker container update
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrdjan committed Feb 9, 2021
1 parent 6c90bcc commit 5b37be1
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 90 deletions.
6 changes: 3 additions & 3 deletions abap-api-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ Command line tool for pattern based applications with ABAP/HANA systems.
npm install -g abap-api-tools
```

With [SAP NWRFC SDK](https://support.sap.com/en/product/connectors/nwrfcsdk.html) dll or so libs locally installed on your notebook, CLI tool can connect to ABAP systems. Check [where to download](https://launchpad.support.sap.com/#/notes/2573790) and [how to install](https://github.com/SAP/node-rfc/blob/master/doc/installation.md#sap-nwrfc-sdk-installation).
With [SAP NWRFC SDK](https://support.sap.com/en/product/connectors/nwrfcsdk.html) binaries installed on your notebook, CLI tool can connect to ABAP systems. Check [where to download](https://launchpad.support.sap.com/#/notes/2573790) and [how to install](https://github.com/SAP/node-rfc/blob/master/doc/installation.md#sap-nwrfc-sdk-installation).

Without [SAP NWRFC SDK](https://support.sap.com/en/product/connectors/nwrfcsdk.html), the `make` command and custom ui configurations can be used with [ABAP annotations sample](https://github.com/SAP/fundamental-tools/tree/sample).
Without [SAP NWRFC SDK](https://support.sap.com/en/product/connectors/nwrfcsdk.html), the `make` command and custom ui configurations can be tested with [ABAP annotations sample](https://github.com/SAP/fundamental-tools/tree/sample).

You can also use the [docker image](https://github.com/SAP/fundamental-tools/tree/main/docker#abap-api-tools), without installing NodeJS or `abap-api-tools` on your notebook:
Using [docker container](https://github.com/SAP/fundamental-tools/tree/main/docker#abap-api-tools) with pre-installed SAP NWRFC SDK, no NodeJS or `abap-api-tools` installation is required on your notebook:

```shell
docker exec cli abap
Expand Down
146 changes: 72 additions & 74 deletions abap-api-tools/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions abap-api-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "abap-api-tools",
"description": "ABAP api tools",
"version": "1.6.2",
"version": "1.6.3",
"homepage": "https://github.com/sap/fundamental-tools",
"author": "SAP",
"license": "Apache-2.0",
Expand Down Expand Up @@ -56,8 +56,8 @@
"@types/node": "^14.14.25",
"@types/sprintf-js": "^1.1.2",
"@types/yargs": "^16.0.0",
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"@typescript-eslint/eslint-plugin": "^4.15.0",
"@typescript-eslint/parser": "^4.15.0",
"eslint": "^7.19.0",
"jest": "^26.6.3",
"typescript": "^4.1.3"
Expand Down
6 changes: 4 additions & 2 deletions abap-api-tools/src/ts/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
ParamClassDesc,
ValueInput,
DefaultFolder,
DockerVolume,
runningInDocker,
} from "./constants";
import { Alpha } from "./alpha";
import { deleteFile, isEmpty, log, yamlLoad, yamlSave } from "./utils";
Expand Down Expand Up @@ -528,8 +530,8 @@ export class Backend {
try {
const addon = await import("node-rfc");
// set sapnwrfc.ini path to working folder mapped to docker image
if (process.env.ABAP_API_TOOLS_WORKING_FOLDER) {
addon.setIniFileDirectory(process.env.ABAP_API_TOOLS_WORKING_FOLDER);
if (runningInDocker) {
addon.setIniFileDirectory(DockerVolume);
}
this.client = new addon.Client({ dest: this.argv.dest });
} catch (ex) {
Expand Down
7 changes: 5 additions & 2 deletions abap-api-tools/src/ts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ export const Tagname = Object.freeze({
[ValueInput.list]: "combo",
});

// when running in docker, the root folder
const WorkingFolder = process.env.ABAP_API_TOOLS_WORKING_FOLDER || "./";

// work folder
export const runningInDocker = process.env.container === "docker";
export const DockerVolume = "/work";
const WorkingFolder = runningInDocker ? DockerVolume : "./";

export const DefaultFolder = Object.freeze({
configuration: path.join(__dirname, "configuration"),
Expand Down
12 changes: 6 additions & 6 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## NodeJS and Python RFC Connectivity
## NodeJS and Python containers

- [Node on Centos](./centos-node.Dockerfile)
- [Python on Centos](./centos-python.Dockerfile)
Expand All @@ -23,18 +23,18 @@ cd myproject
edit sapnwrfc.ini
```

Docker image with pre-installed SAP NWRFC SDK is available in SAP-internal network only ([link](https://docker.wdf.sap.corp:10443/artifactory/webapp/#/packages/docker/vpcoe~2Fabap-api-tools)). The local working directory `myproject` must be mapped to docker volume `work`:
Docker image with pre-installed SAP NWRFC SDK is available in SAP-internal network only ([link](https://docker.wdf.sap.corp:10443/artifactory/webapp/#/packages/docker/vpcoe~2Fabap-api-tools)). The local working directory `myproject` shall be mapped to docker volume `work`:

```shell
docker pull docker.wdf.sap.corp:51689/vpcoe/abap-api-tools
docker run --name cli -it -v <absolute path to>/myproject:/work --env ABAP_API_TOOLS_WORKING_FOLDER=/work docker.wdf.sap.corp:51689/vpcoe/abap-api-tools
docker run --name cli -it -v <absolute path to>/myproject:/work docker.wdf.sap.corp:51689/vpcoe/abap-api-tools
```

The container can be also built from [abap-node.Dockerfile](./abap-node.Dockerfile). SAP NWRFC SDK folder "nwrfcsdk" shall be in that case first copied to Dockerfile folder:
The container can be also built from [abap-api-tools.Dockerfile](./abap-api-tools.Dockerfile). SAP NWRFC SDK folder "nwrfcsdk" shall be in that case first copied to Dockerfile folder:

```shell
docker build --rm --no-cache -t abap-api-tools -f abap-node.Dockerfile .
docker run --name cli -it -v <path to>/myproject:/work --env ABAP_API_TOOLS_WORKING_FOLDER=/work abap-api-tools
docker build --rm --no-cache -t abap-api-tools -f abap-api-tools.Dockerfile .
docker run --name cli -it -v <path to>/myproject:/work abap-api-tools
```

Once the `cli` container is up and running, the `abap` CLI can be invoked:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

FROM node:15

ENV container docker

ARG nwrfc_source=/nwrfcsdk
ARG nwrfc_target=/usr/local/sap

Expand Down

0 comments on commit 5b37be1

Please sign in to comment.