1
FROM rocker/r-ver:4.0.5  #build
RUN apt-get clean all && \
    apt-get update && apt-get install -y git \
    apt-get upgrade -y && \
    apt-get install -y \
    apt-get purge && \
    && apt-get install cron -y 
    && apt-get install vim -y
    && rm -rf /var/lib/apt/lists/*
RUN apk add --no-cache git
RUN mkdir -p /home/project
WORKDIR /home/project
COPY . /home/project
RUN /usr/bin/R --vanilla -f install_libraries.R
RUN R -e "install.packages(c('rJava','devtools','digest', 'dplyr','futile.logger','RJDBC', 'yaml', 'purrr','lubridate', 'testthat','noctua'), dependencies = TRUE)"
RUN R -e "devtools::install_github('DyfanJones/noctua')"
RUN R -e "install.packages('cmutils', repos =NULL, type='source')"
CMD ["Rscript", "R"]

When I run the pipeline I am getting error "COMMAND_EXECUTION_ERROR: Error while executing command: docker build -t $IMAGE_REPO_NAME:IMAGE_TAG .. Reason: exit status 1" in BUILD stage and "COMMAND_EXECUTION_ERROR: Error while executing command: docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG. Reason: exit status 1" POST_BUILD stage.

Can any help me!!??

version: 0.2
env: 
  variables: 
    AWS_DEFAULT_REGION: ap-south-1
    IMAGE_REPO_NAME: dev-testdocker-service
    IMAGE_REPO_URI: 566563558581.dkr.ecr.eu-west-1.amazonaws.com/dev-testdocker-service
    IMAGE_TAG: latest
    AWS_ACCOUNT_ID: 566563558581
phases:
  install:
    runtime-versions:
      docker: 18
  pre_build:
    commands:
      - "echo Logging in to Amazon ECR..."
      - "aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com"
  build:
    commands:
      - echo Build started on `date`
      - echo Building Docker test image...
      - "docker build -t $IMAGE_REPO_NAME:IMAGE_TAG ."
      - "docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG"
  post_build:
    commands:
      - echo Build completed on `date`
      - "echo Pushing the Docker image."
      - "docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG"
artifacts:
  file:
   - "**/*"
Rajeev
  • 17
  • 5
  • "Exit status 1" usually just means "something went wrong", or in this case "one of the `RUN` lines failed"; is there more to the error message, do you know which command has the error? – David Maze Jun 27 '22 at 10:46
  • @DavidMaze I am getting this 2 error one is build phase and another is on post_build phase (i) "BUILD Failed COMMAND_EXECUTION_ERROR: Error while executing command: docker build -t $IMAGE_REPO_NAME:IMAGE_TAG .. Reason: exit status 1 (ii) POST_BUILD Failed COMMAND_EXECUTION_ERROR: Error while executing command: docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG. Reason: exit status 1" – Rajeev Jun 27 '22 at 10:51
  • Yes, you included in that question. The actual thing that caused the build to fail should be before that. – David Maze Jun 27 '22 at 10:59
  • @DavidMaze Should I have to make changes in Dockerfile or buildspec.yml and where I have to make change. Can you pls guide me? – Rajeev Jun 27 '22 at 11:45

0 Answers0