How to docker build with Drone using Private ECR?

Here is an example of how to use the ECR plugin to create a docker build using a drone and the ECR plugin:

drone.yaml

---
kind: pipeline
name: default

steps:
- name: publish  
  image: public.ecr.aws/u1i8o7n1/plugins/ecr:latest
  privileged: true
  settings:
    access_key: REMOVED
    secret_key: REMOVED
    repo: my-first-ecr-repo
    registry: 915632791698.dkr.ecr.us-east-1.amazonaws.com
    region: us-east-1
    tags:
        - '1.0.1

The dummy Dockerfile:

FROM 915632791698.dkr.ecr.us-east-1.amazonaws.com/my-first-ecr-repo:1.0.1_drone

RUN apk update && apk add \
    curl \
    git \
    vim
ENTRYPOINT ["git"]
CMD ["--help"]

It is also necessary to change the repository settings on the Drone in Trusted options:

I changed it in my repository and with the commit ID: 8e95c21


And the Build:

The final pipeline build:

1 Like