【问题标题】:Github action: [error]Process completed with exit code 1. Trying to push docker image into ecr repoGithub 操作:[错误]进程已完成,退出代码为 1。尝试将 docker 映像推送到 ecr 存储库
【发布时间】:2022-11-20 09:14:26
【问题描述】:

我正在尝试使用 githubaction 做 aws 管道并部署到 aws fargate。我可以创建我的 docker 镜像,但无法使用 github 操作推送到 ECR 存储库。

姓名:CI 上: 推: 分支机构:[开发] 拉请求: 分支机构:[开发] 工作: 建造: 运行:ubuntu-latest 脚步: # 在 $GITHUB_WORKSPACE 下签出你的仓库,这样你的工作就可以访问它 - 使用:actions/checkout@v2

  # Runs a single command using the runners shell
  - name: Lint code
    run: echo "Linting repository!"
  # Runs a set of commands using the runners shell
  - name: Run unit tests
    run: |
      echo "Running unit tests"
  - name: Configure AWS credentials
    uses: aws-actions/configure-aws-credentials@v1
    with:
      aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
      aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      aws-region: us-east-2

  - name: Login to Amazon ECR
    id: login-ecr
    uses: aws-actions/amazon-ecr-login@v1
  - name: Build, tag, and push image to Amazon ECR
    id: build-image
    env:
      ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
      ECR_REPOSITORY: cmssdemo
      IMAGE_TAG: latest
    run: |
      docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
      docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
      echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
  - name: Download task definition
    run: |
      aws ecs describe-task-definition --task-definition ${{ secrets.ECS_CONTAINER_DEFINITION }} \
      --query taskDefinition > task-definition.json
  - name: Fill in the new image ID in the Amazon ECS task definition
    id: task-def
    uses: aws-actions/amazon-ecs-render-task-definition@v1
    with:
      task-definition: task-definition.json
      container-name: ${{ secrets.ECS_CONTAINER_NAME }}
      image: ${{ steps.build-image.outputs.image }}
 - name: Deploy Amazon ECS task definition
    uses: aws-actions/amazon-ecs-deploy-task-definition@v1
    with:
      task-definition: ${{ steps.task-def.outputs.task-definition }}
      service: ${{ secrets.ECS_SERVICE }}
      cluster: ${{ secrets.ECS_CLUSTER }}
      wait-for-service-stability: true

我的 githubaction 脚本

【问题讨论】:

    标签: dockerfile github-actions aws-fargate cicd amazon-ecr


    【解决方案1】:

    你找到答案了吗?我面临着同样的问题

    【讨论】:

    • Pushpit,请不要添加我也是作为答案。它实际上并没有提供问题的答案。如果您有不同但相关的问题,请ask它(如果它有助于提供上下文,请参考此问题)。如果你对这个具体问题感兴趣,你可以upvote它,留下comment,或者一旦你有足够的reputation就开始bounty
    猜你喜欢
    • 2022-01-17
    • 1970-01-01
    • 2022-08-03
    • 1970-01-01
    • 2016-06-12
    • 2022-07-27
    • 2021-07-10
    • 1970-01-01
    • 2022-01-16
    相关资源
    最近更新 更多