Asool
Asool

Reputation: 14209

Docker Build Failing on Travis --> can't find app/build

I am trying to push my images from Travis CI to docker hub.

Here is my Dockerfile

FROM node:alpine as builder 
WORKDIR /app
COPY ./package.json ./
RUN npm install
COPY . .
CMD npm run build


FROM nginx
EXPOSE 3000
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/build /usr/share/nginx/html

My .travis.yml

sudo: required
services:
  - docker

before_install:
  - docker build -t aseel/react-test -f ./client/Dockerfile.dev ./client

script:
  - docker run -e CI=true aseel/react-test npm run test

after_success:
  - docker build -t aseel/multi-client ./client
  - docker build -t aseel/multi-nginx ./nginx
  - docker build -t aseel/multi-server ./server
  - docker build -t aseel/multi-worker ./worker
  - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin
  - docker push aseel/multi-server
  - docker push aseel/multi-nginx
  - docker push aseel/multi-worker
  - docker push aseel/multi-client

The reason the push is failing is because this command

docker build -t aseel/multi-client ./client

is failing on travis (but not locally).

More specifically, I'm getting this error on travis

COPY failed: stat /var/lib/docker/overlay2/135282513e177be132b6978986f878ba61f3b89914b6b2f7030cbafa0d33f629/merged/app/build: no such file or directory

Any idea why this is happening?

Upvotes: 1

Views: 169

Answers (1)

Asool
Asool

Reputation: 14209

I needed to switch CMD to RUN -- It was a pretty silly mistake

Upvotes: 0

Related Questions