File tree 3 files changed +72
-0
lines changed
3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ extends: default
3
+
4
+ rules:
5
+ line-length:
6
+ max: 100
7
+ indentation:
8
+ spaces: 2
9
+ indent-sequences: true
Original file line number Diff line number Diff line change @@ -14,6 +14,24 @@ The username used for login to Docker Hub.
14
14
The access token used for login to Docker Hub. This is required if
15
15
` docker-hub-username ` was set.
16
16
17
+ ## ` aws-access-key-id `
18
+
19
+ The access key used for login to Amazon Elastic Container Registry (Amazon ECR).
20
+
21
+ ## ` aws-secret-access-key `
22
+
23
+ The secret access key used for login to Amazon ECR. This is required if
24
+ ` aws-access-key-id ` was set.
25
+
26
+ ## ` aws-region `
27
+
28
+ The AWS region where the Amazon ECR is located. Uses ` eu-west-1 ` by default.
29
+
30
+ ## ` aws-account-id `
31
+
32
+ The id of the AWS account where the Amazon ECR is located. Usually the
33
+ tooling account's id. This is required if ` aws-access-key-id ` was set.
34
+
17
35
### ` service-containers `
18
36
19
37
A list of containers to start before building the primary container.
@@ -34,6 +52,8 @@ container must be named `db`.
34
52
35
53
## Example usage
36
54
55
+ ### With Docker Hub
56
+
37
57
``` yaml
38
58
uses : aexeagmbh/gh-actions-docker-compose-up@main
39
59
with :
43
63
db-name : bar
44
64
working-directory : ./baz
45
65
` ` `
66
+
67
+ ### With Amazon ECR
68
+
69
+ ` ` ` yaml
70
+ uses : aexeagmbh/gh-actions-docker-compose-up@main
71
+ with :
72
+ aws-access-key-id : AKIAIOSFODNN7EXAMPLE
73
+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
74
+ service-containers : db redis
75
+ db-name : bar
76
+ working-directory : ./baz
77
+ ` ` `
Original file line number Diff line number Diff line change 4
4
description : Username for Docker Hub login
5
5
docker-hub-access-token :
6
6
description : Access token for Docker Hub login
7
+ aws-access-key-id :
8
+ description : Access key for AWS user with Amazon ECR access
9
+ default : ' '
10
+ aws-secret-access-key :
11
+ description : Secret access key for AWS user with Amazon ECR access
12
+ default : ' '
13
+ aws-region :
14
+ description : AWS region where Amazon ECR is located
15
+ default : eu-west-1
16
+ aws-account-id :
17
+ description : Id of AWS account where Amazon ECR is located
18
+ default : ' '
7
19
service-containers :
8
20
description : Service containers to start
9
21
db-name :
50
62
DOCKER_HUB_ACCESS_TOKEN : ${{ inputs.docker-hub-access-token }}
51
63
shell : bash
52
64
working-directory : ${{ inputs.working-directory }}
65
+ - name : Login to Amazon ECR
66
+ run : |
67
+ echo "::group::Login to Amazon ECR"
68
+ if [ "${{ inputs.aws-access-key-id }}" != "" ]; then
69
+ echo "[default]" > .aws-credentials
70
+ echo "aws_access_key_id=${{ inputs.aws-access-key-id }}" >> .aws-credentials
71
+ echo "aws_secret_access_key=${{ inputs.aws-secret-access-key }}" >> .aws-credentials
72
+ docker run --rm -it \
73
+ -v ${PWD}/.aws-credentials:/root/.aws/credentials:ro \
74
+ amazon/aws-cli:latest ecr get-login-password --region "${{ inputs.aws-region }}" | \
75
+ docker login --username AWS --password-stdin \
76
+ "${{ inputs.aws-account-id }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com"
77
+ rm .aws-credentials
78
+ else
79
+ echo "skipped"
80
+ fi
81
+ echo "::endgroup::"
82
+ shell : bash
83
+ working-directory : ${{ inputs.working-directory }}
53
84
- name : Start service containers
54
85
run : |
55
86
# Start the service containers before building custom container images.
You can’t perform that action at this time.
0 commit comments