-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-aws-ecr-image.yaml
52 lines (44 loc) · 1.73 KB
/
build-aws-ecr-image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
id: build-aws-ecr-image
namespace: company.team
tasks:
- id: fetch_auth_token
type: io.kestra.plugin.aws.ecr.GetAuthToken
accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
secretKeyId: "{{ secret('AWS_SECRET_ACCESS_KEY') }}"
region: "{{ secret('AWS_DEFAULT_REGION') }}"
- id: build
type: io.kestra.plugin.docker.Build
dockerfile: |
FROM python:3.10
RUN pip install --upgrade pip
RUN pip install --no-cache-dir kestra requests "polars[all]"
tags:
- 123456789.dkr.ecr.eu-central-1.amazonaws.com/data-infastructure:latest
push: true
credentials:
username: AWS
password: "{{ outputs.fetch_auth_token.token }}"
extend:
title: Build a Docker image and push it to AWS Elastic Container Registry (ECR)
description: >-
This flow will build a Docker image and push it to a remote container
registry.
1. The `dockerfile` parameter is a multiline string that contains the
Dockerfile content. However, it can also be a path to a file.
2. The `tags` parameter is a list of tags of the image to build. Make sure
to set a correct AWS region, and adjust the rest of the image URL to match
your ECR repository.
3. The `push` parameter is a boolean that indicates whether to push the
image to the Elastic Container Registry.
4. Make sure to securely store your AWS credentials as secrets or
environment variables.
5. Finally, note how we used the `GetAuthToken` task to fetch an access
token for the `docker` command. This is necessary to authenticate the task
with your ECR registry.
tags:
- Docker
- AWS
ee: false
demo: false
meta_description: This flow will build a Docker image and push it to a remote
container registry.