问题描述
我已经使用 Travis CI 设置了 CI/CD 管道,这样当我将代码推送到它时,它会自动部署到 AWS beanstalk.我在 AWS 中使用 docker 作为平台.当我推送它通过 travis 的代码时,但 aws 显示错误实例上的命令失败.返回代码:1 输出:Dockerfile 和 Dockerrun.aws.json 都丢失,中止部署."我不需要 dockerrun.aws.json 因为我使用的是本地 docker 镜像但无法弄清楚为什么会显示此错误,因为有一个 docker 文件.
I have set up a CI/CD pipeline using Travis CI so that when i push the code to it automatically gets deployed to AWS beanstalk.I am using docker as a platform in AWS.When i push the code it passes through travis but aws shows the error "Command failed on instance. Return code: 1 Output: Dockerfile and Dockerrun.aws.json are both missing, abort deployment."I don't need dockerrun.aws.json as i am using a local docker imageBut not able to figure out why is this error being shown as there is a docker file.
特拉维斯文件
sudo: required
language: node_js
node_js:
- "10.16.0"
sudo: true
addons:
chrome: stable
branches:
only:
- master
before_script:
- npm install -g @angular/cli
script:
- ng test --watch=false --browsers=ChromeHeadless
deploy:
provider: elasticbeanstalk
access_key_id:
secure: "$accesskey"
secret_access_key:
secure: "$AWS_SECRET_KEY"
region: "us-east-2"
app: "portfolio"
env: "portfolio-env"
bucket_name: "elasticbeanstalk-us-east-2-646900675324"
bucket_path: "portfolio"
Dockerfile
FROM node:12.7.0-alpine as builder
WORKDIR /src/app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build
# To copy the files from build folder to directory where nginx could serve up the files
FROM nginx
EXPOSE 80
COPY --from=builder /src/app/dist/portfio /usr/share/nginx/html
对此有任何可能的解决方案吗?
Any possible solution for this one ?
推荐答案
我遇到了同样的问题.原来我的 dockerfile 没有大写,而且 AWS 区分大小写.当我将文件名更改为Dockerfile"时,一切都按预期工作.
I had the same issue. Turns out my dockerfile was not capitalized, and AWS is case sensitive. When I changed the file name to "Dockerfile", everything worked as expected.
这篇关于返回码:1 输出:Dockerfile 和 Dockerrun.aws.json 都丢失,中止部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!