diff --git a/README.md b/README.md index 5aa62709..0ae746c3 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/docker-compose.devci.yml b/docker-compose.devci.yml index 29c8a89a..f9393e07 100644 --- a/docker-compose.devci.yml +++ b/docker-compose.devci.yml @@ -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