Skip to content

Commit e4189b3

Browse files
committed
Added config files for testing code in Docker
1 parent d735420 commit e4189b3

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/node_modules

CONTRIBUTING.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ First fork and clone the repo:
77
git clone [email protected]:your-username/JsBarcode.git
88
````
99

10-
Then run ``npm install`` to set everything up. Make sure you have all dependencies of [node-canvas](https://github.com/Automattic/node-canvas) installed before doing this.
10+
Then run ``npm install`` to set everything up. Make sure you have all dependencies of [node-canvas](https://github.com/Automattic/node-canvas) installed before doing this, or check **Using Docker** section.
1111

1212
You are now ready to start doing your changes.
1313

@@ -30,6 +30,10 @@ JsBarcode has tests on all barcode symbologies (and more). If you want to test y
3030

3131
There are also visual tests located under ``test/browser/``.
3232

33+
Using Docker
34+
----
35+
If you have installed [Docker](https://www.docker.com), you can avoid local installation of dependencies for [node-canvas](https://github.com/Automattic/node-canvas). For doing that, run ``npm install --ignore-scripts`` instead of ``npm install``. Then you can run tests by ``docker-compose up``
36+
3337
Symbologies and The Core
3438
----
3539
JsBarcode is divided up in two distinct parts. The barcode symbologies (EAN-13, CODE128, ITF, ...) and the core.

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node:8
2+
3+
RUN apt-get update && apt-get install -qq libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++
4+
5+
RUN mkdir -p /frontend
6+
WORKDIR /frontend
7+
COPY ./ ./
8+
9+
RUN npm install
10+
11+
CMD npm test
12+
13+
EXPOSE 3000

docker-compose.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '2'
2+
services:
3+
jsbarcode:
4+
build:
5+
context: ./
6+
volumes:
7+
- ./src:/frontend/src
8+
- ./test:/frontend/test
9+
ports:
10+
- 3000:3000

0 commit comments

Comments
 (0)