Reputation: 378
I'm trying to setup a basic pipeline in Gitlab that does the following: Run tests command, compile the client and deploy the application using docker-compose.
The problem comes when I'm trying to use npm install
.
My .gitlab-ci.yml
file looks like:
# This file is a template, and might need editing before it works on your
project.
# Official docker image.
image: docker:latest
services:
- docker:dind
stages:
- test
- build
- deploy
build:
stage: build
script:
- cd packages/public/client/
- npm install --only=production
- npm run build
test:
stage: test
only:
- develop
- production
script:
- echo run tests in this section
step-deploy-production:
stage: deploy
only:
- production
script:
- docker-compose up -d --build
environment: production
when: manual
And the error is:
Skipping Git submodules setup
$ cd packages/public/client/
$ npm install --only=production
bash: line 69: npm: command not found
ERROR: Job failed: exit status 1
I'm using the last docker image, so, I'm wondering whether I can define a new service on my build stage or should I use a different image for the whole process?
Thanks
Upvotes: 0
Views: 6668
Reputation: 3930
A new service will not help you, you'll need to use a different image.
You can use a node image just for your build
-stage like this:
build:
image: node:8
stage: build
script:
- cd packages/public/client/
- npm install --only=production
- npm run build
Upvotes: 3