1

I'm setting up travis to push images to docker hub after running a test script

sudo: required
services:
  - docker
before_install:
  - docker build -t oskygh/react-test -f ./client/Dockerfile.dev ./client
script:
  - docker run oskygh/react-test npm test -- --coverage
after_success:
  - docker build -t osbee/client ./client
  - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin
  - docker push osbee/client

dockerfile.dev

FROM node:alpine
WORKDIR '/app'
COPY ./package.json ./
RUN npm install
COPY . .
CMD ["npm","run","start"]
Osborne Saka
  • 469
  • 1
  • 4
  • 21

1 Answers1

1

As explained here you could use the travis_wait function. Adding it before the command, which failed. You could also read this stackoverflow, which added it in another way.

Siad Ardroumli
  • 596
  • 2
  • 9
  • @OsborneSaka The last suggestion I have then, would be to move `docker run oskygh/react-test npm test -- --coverage` to the before_install section and run your tests without docker under scripts. Good luck. – Siad Ardroumli Jun 15 '19 at 20:30