Skip to content

Commit

Permalink
feat: add Dockerfile (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya authored Jun 30, 2021
1 parent c9fc436 commit e4dad0f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM openjdk:16.0.1-jdk-slim-buster
RUN apt-get update -yq \
&& apt-get install -yq curl \
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -yq nodejs

COPY package-lock.json .
RUN npm install
COPY . .
18 changes: 15 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# Development guideline
These are some of the development guidelines and help to setup the library for development.

## Docker
A [Dockerfile](../Dockerfile) is provided and can be used for running test suites or any other command.
You can either build the image and run the needed commands manually or rather use any of the following npm scripts:

- `npm run docker:build` builds the docker image with the tag `asyncapi/modelina` (the rest of the scripts run this one as well).
- `npm run docker:test` runs the main test suite.
- `npm run docker:test:blackbox` runs the blackbox test suite.

## Environment setup

To setup the environment follow these steps:
1. Setup the project by first installing the dependencies `npm install`
1. Make sure the tests pass by running `npm run test` script
- [blackbox testing](#blackbox-testing) are excluded when running the `test` script because it require some extra setup.
1. Make sure code is well formatted and secure `npm run lint`
2. Make sure the tests pass by running `npm run test` script
- [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.
3. Make sure code is well formatted and secure `npm run lint`

## Blackbox testing
Please refer to [Docker section](#docker) above if you wanna run the tests directly in Docker without configuring anything extra on your machine.
If you prefer to install all the dependencies locally, keep reading.

The blackbox testing have some different requirements in order to successfully run:
- To to run the `java` blackbox tests, you need to have JDK installed.
- To to run the `ts` blackbox tests, you need to have TypeScript installed globally - `npm install -g typescript`.
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
"build:cjs": "tsc",
"build:esm": "tsc --project tsconfig.json --module ESNext --outDir ./lib/esm",
"build:types": "tsc --project tsconfig.json --declaration --emitDeclarationOnly --declarationMap --outDir ./lib/types",
"docker:build": "docker build -q -t asyncapi/modelina .",
"docker:test": "npm run docker:build && docker run asyncapi/modelina npm run test",
"docker:test:blackbox": "npm run docker:build && docker run asyncapi/modelina npm run test:blackbox",
"test": "cross-env CI=true jest --coverage --testPathIgnorePatterns ./test/blackbox",
"test:blackbox": "cross-env CI=true jest ./test/blackbox",
"test:watch": "jest --watch",
Expand Down

0 comments on commit e4dad0f

Please sign in to comment.