Add command to spawn a development environment

For development, now doing `npm run dev` will spawn containers with the
necessary dependencies for developing and testing the supervisor.
This commit is contained in:
Felipe Lalanne 2022-08-22 16:18:33 -04:00
parent c1e6dadeb4
commit 44f3e9ccdb
3 changed files with 32 additions and 0 deletions

View File

@ -101,6 +101,11 @@ COPY src ./src
COPY test ./test
COPY typings ./typings
##################################################
# CI tests are ran here
##################################################
FROM test as test-ci
# Run tests
RUN npm run test

25
docker-compose.dev.yml Normal file
View File

@ -0,0 +1,25 @@
version: '2'
services:
docker:
image: docker:dind
privileged: true
environment:
DOCKER_TLS_CERTDIR: ''
command: --tls=false --debug
sut:
build:
context: ./
dockerfile: Dockerfile.template
target: test
args:
# Change this if testing in another architecture
ARCH: amd64
command: sleep infinity
environment:
DOCKER_HOST: tcp://docker:2375
volumes:
- './.mochapodrc.yml:/usr/src/app/.mochapodrc.yml'
- './src:/usr/src/app/src'
- './test:/usr/src/app/test'

View File

@ -8,6 +8,8 @@
"url": "https://github.com/balena-os/balena-supervisor.git"
},
"scripts": {
"dev": "docker-compose -f docker-compose.dev.yml up --build || npm run compose:down",
"compose:down": "docker-compose -f docker-compose.dev.yml down",
"start": "./entry.sh",
"build": "npm run clean && npm run release && webpack",
"lint": "balena-lint -e ts -e js --typescript src/ test/ typings/ build-utils/ webpack.config.js",