Home > front end >  Why is AWS CodePipeline complaining about 'Dockerfile' and 'Dockerrun.aws.json'?
Why is AWS CodePipeline complaining about 'Dockerfile' and 'Dockerrun.aws.json'?

Time:10-27

I am creating a CodePipeline for my application, but the deployment process for AWS ElasticBeanstalk is failing with the following error:

Instance deployment: Both 'Dockerfile' and 'Dockerrun.aws.json' are missing in your source bundle. Include at least one of them. The deployment failed.

The complete message error is:

Deployment completed, but with errors: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version. Failed to deploy application. Unsuccessful command execution on instance id(s) 'i-0b8823de2e7376c81'. Aborting the operation. [Instance: i-0b8823de2e7376c81] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error.. Instance deployment failed. For details, see 'eb-engine.log'. Instance deployment: Both 'Dockerfile' and 'Dockerrun.aws.json' are missing in your source bundle. Include at least one of them. The deployment failed.

My environment has 3 containers and to deploy this environment I use the docker-compose-qa.yml file and in AWS CodeBuild I'm defining this file as an artifact, as shown below:

artifacts:
  files:
    - 'docker-compose-qa.yml'

The docker-compose-qa.yml:

version: '3.8'

services:

    sitr-api:
        image: ${{ secrets.SITR_API_QA_URI_DOCKER_IMG }}
        container_name: sitr-api-qa
        environment:
            - ASPNETCORE_ENVIRONMENT=QA
        ports:
            - "9901:80"
        volumes:
            - "./Host-Logs:/app/App_Data/Logs"

    sitr-app:
        image: ${{ secrets.SITR_APP_QA_URI_DOCKER_IMG }}
        container_name: sitr-app-qa
        ports:
            - "9902:80"
    
    sitr-nginx: 
        image: ${{ secrets.SITR_NGINX_QA_URI_DOCKER_IMG }}
        container_name: sitr-nginx-qa
        depends_on: 
          - sitr-app
          - sitr-api
        ports: 
          - "80:80"

eb-engine.log error:

2021/10/26 22:07:27.977004 [ERROR] An error occurred during execution of command [app-deploy] - [Docker Specific Build Application]. Stop running the command. Error: Dockerfile and Dockerrun.aws.json are both missing, abort deployment

2021/10/26 22:07:27.977008 [INFO] Executing cleanup logic 2021/10/26 22:07:27.977098 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: Both 'Dockerfile' and 'Dockerrun.aws.json' are missing in your source bundle. Include at least one of them. The deployment failed.","timestamp":1635286047,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1635286047,"severity":"ERROR"}]}]}

My CodeBuild just build a dotnet application, angular aplication and build the 3 docker containers for both application and nginx.

If I run my CodeBuild manually and then choose my docker-compose-qa.yml file in AWS EB, the publication is successfully applied.

I checked AWS S3 Bucket and the file is being zipped to a folder for the artifact.

The question is:

Why is Pipeline complaining about the non-existence of 'Dockerfile' and 'Dockerrun.aws.json' files? How can I specify it to use the docker-compose-qa.yml file?

CodePudding user response:

Based on the comments.

The issue was caused by wrong file name. It should be called docker-compose.yml, not docker-compose-qa.yml. Renaming the file solved the issue.

  • Related