Skip to content

Commit e4dad0f

Browse files
authored
feat: add Dockerfile (#281)
1 parent c9fc436 commit e4dad0f

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM openjdk:16.0.1-jdk-slim-buster
2+
RUN apt-get update -yq \
3+
&& apt-get install -yq curl \
4+
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
5+
&& apt-get install -yq nodejs
6+
7+
COPY package-lock.json .
8+
RUN npm install
9+
COPY . .

docs/development.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
# Development guideline
22
These are some of the development guidelines and help to setup the library for development.
33

4+
## Docker
5+
A [Dockerfile](../Dockerfile) is provided and can be used for running test suites or any other command.
6+
You can either build the image and run the needed commands manually or rather use any of the following npm scripts:
7+
8+
- `npm run docker:build` builds the docker image with the tag `asyncapi/modelina` (the rest of the scripts run this one as well).
9+
- `npm run docker:test` runs the main test suite.
10+
- `npm run docker:test:blackbox` runs the blackbox test suite.
11+
412
## Environment setup
13+
514
To setup the environment follow these steps:
615
1. Setup the project by first installing the dependencies `npm install`
7-
1. Make sure the tests pass by running `npm run test` script
8-
- [blackbox testing](#blackbox-testing) are excluded when running the `test` script because it require some extra setup.
9-
1. Make sure code is well formatted and secure `npm run lint`
16+
2. Make sure the tests pass by running `npm run test` script
17+
- [blackbox testing](#blackbox-testing) are excluded when running the `test` script because it require some extra setup. Please refer to [Blackbox testing section](#blackbox-testing) below.
18+
3. Make sure code is well formatted and secure `npm run lint`
1019

1120
## Blackbox testing
21+
Please refer to [Docker section](#docker) above if you wanna run the tests directly in Docker without configuring anything extra on your machine.
22+
If you prefer to install all the dependencies locally, keep reading.
23+
1224
The blackbox testing have some different requirements in order to successfully run:
1325
- To to run the `java` blackbox tests, you need to have JDK installed.
1426
- To to run the `ts` blackbox tests, you need to have TypeScript installed globally - `npm install -g typescript`.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
"build:cjs": "tsc",
6363
"build:esm": "tsc --project tsconfig.json --module ESNext --outDir ./lib/esm",
6464
"build:types": "tsc --project tsconfig.json --declaration --emitDeclarationOnly --declarationMap --outDir ./lib/types",
65+
"docker:build": "docker build -q -t asyncapi/modelina .",
66+
"docker:test": "npm run docker:build && docker run asyncapi/modelina npm run test",
67+
"docker:test:blackbox": "npm run docker:build && docker run asyncapi/modelina npm run test:blackbox",
6568
"test": "cross-env CI=true jest --coverage --testPathIgnorePatterns ./test/blackbox",
6669
"test:blackbox": "cross-env CI=true jest ./test/blackbox",
6770
"test:watch": "jest --watch",

0 commit comments

Comments
 (0)