我正在尝试将我的图像从Travis CI推送到docker hub。
这是我的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
我的.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
推送失败的原因是因为该命令
docker build -t aseel/multi-client ./client
在travis上失败(但不是在本地)。
更具体地说,我在travis上收到此错误
复制失败:统计 / var / lib / docker / overlay2 / 135282513e177be132b6978986f878ba61f3b89914b6b2f7030cbafa0d33f629 / merged / app / build: 没有这样的文件或目录
知道为什么会这样吗?
答案 0 :(得分:0)
我需要将CMD切换为RUN-这是一个非常愚蠢的错误