Skip to content

Commit

Permalink
Added machinery and instructions about adding new dependencies to the…
Browse files Browse the repository at this point in the history
… project.
  • Loading branch information
jmfernandez committed May 16, 2024
1 parent e25fe9b commit 63a97a3
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,26 @@ docker compose -f docker-compose.devci.yml up
```

Then, the continuous integration server is available both at 3000 and 8080.

## Adding new dependencies

Once docker compose is up and running, and you want to add some dependencies
to `package.json` and updated `package-lock.json`, you have to do next in
a separated terminal:

```bash
DEPENDENCIES=mynewdepency docker compose -f docker-compose.devci.yml run npm_install_deps
```

After that, you might need to restart it through

```bash
docker compose -f docker-compose.devci.yml restart nuxt
```

Have a look at the messages, because some mismatch between the dependencies
of the new packages and the already recorded ones could break havoc.

In those cases, you need to figure out the source of the problem, rollback
both `package.json` and `package-lock.json`, and re-add the updated
dependency.
58 changes: 58 additions & 0 deletions docker-compose.devci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,69 @@ volumes:
dist-volume:
node-modules-volume:
services:
npm_ci_deps:
build:
context: .
dockerfile: Dockerfile.devci
image: openebench-nuxt:devci
user: ${DEV_UID:-0}:${DEV_GID:-0}
command: npm ci
volumes:
- ./assets:/app/assets:ro
- ./components:/app/components:ro
- ./config:/app/config:ro
- ./layouts:/app/layouts:ro
- ./pages:/app/pages:ro
- ./plugins:/app/plugins:ro
- ./static:/app/static
- ./store:/app/store:ro
- ./stories:/app/stories:ro
- ./test:/app/test:ro
- ./jest.config.js:/app/jest.config.js:ro
- ./nuxt.config.js:/app/nuxt.config.js:ro
- ./package.json:/app/package.json:ro
- ./package-lock.json:/app/package-lock.json
- ./stylelint.config.js:/app/stylelint.config.js:ro
- ./tsconfig.json:/app/tsconfig.json:ro

- node-modules-volume:/app/node_modules
npm_install_deps:
build:
context: .
dockerfile: Dockerfile.devci
image: openebench-nuxt:devci
user: ${DEV_UID:-0}:${DEV_GID:-0}
profiles:
- manual
command: npm install ${DEPENDENCIES:-YOU_NEED_TO_PROVIDE_YOUR_DEPENDENCIES_THROUGH_DEPENDENCIES_VARIABLE_TO_DOCKER_COMPOSE}
volumes:
- ./assets:/app/assets:ro
- ./components:/app/components:ro
- ./config:/app/config:ro
- ./layouts:/app/layouts:ro
- ./pages:/app/pages:ro
- ./plugins:/app/plugins:ro
- ./static:/app/static
- ./store:/app/store:ro
- ./stories:/app/stories:ro
- ./test:/app/test:ro
- ./jest.config.js:/app/jest.config.js:ro
- ./nuxt.config.js:/app/nuxt.config.js:ro
- ./package.json:/app/package.json
- ./package-lock.json:/app/package-lock.json
- ./stylelint.config.js:/app/stylelint.config.js:ro
- ./tsconfig.json:/app/tsconfig.json:ro

- node-modules-volume:/app/node_modules
nuxt:
build:
context: .
dockerfile: Dockerfile.devci
image: openebench-nuxt:devci
user: ${DEV_UID:-0}:${DEV_GID:-0}
depends_on:
npm_ci_deps:
condition: service_completed_successfully
restart: on-failure
volumes:
- ./assets:/app/assets:ro
Expand Down

0 comments on commit 63a97a3

Please sign in to comment.