docs: explain how to work with the dockerfile

This commit is contained in:
Michel Jonathan Schmitz
2019-06-25 09:54:35 +02:00
parent 9c90dadbef
commit 039905742f

View File

@@ -9,29 +9,41 @@
## How to get started ## How to get started
To install all needed `npm` packages: To install all needed `npm` packages:
```sh ```shell
npm install npm install
``` ```
To prepare the script to be executed, run: To prepare the script to be executed, run:
```sh ```shell
npm run build npm run build
``` ```
To execute the code in "CLI" script (basically to execute the connector): To execute the code in "CLI" script (basically to execute the connector):
```sh ```shell
node lib/cli.js run <backendURL> <origin> <licensePlate> node lib/cli.js run <backendURL> <origin> <licensePlate>
e.g.: e.g.:
node lib/cli.js run http://localhost:3000 minimal-connector f-u node lib/cli.js run http://localhost:3000 minimal-connector f-u
``` ```
To run some sample tests, use: To run some sample tests, use:
```sh ```shell
npm test npm test
``` ```
The `npm` scripts are defined in `package.json` file. The `npm` scripts are defined in `package.json` file.
After building the project once, the connector image can be build.
```shell
docker build .
```
Use the following command to run the container of this connector. Assuming there is a local backend running.
```shell
docker run --network host <image-id> <backendURL> <origin> <licensePlate>
e.g.:
docker run --network host registry.gitlab.com/openstapps/minimal-connector http://localhost:3000 minimal-connector f-u
```
## Creating your own connector ## Creating your own connector
1. Update the `executeConnector`-function in `cli.ts` according to the comments and needs of your connector 1. Update the `executeConnector`-function in `cli.ts` according to the comments and needs of your connector