-
Notifications
You must be signed in to change notification settings - Fork 5.7k
208 lines (191 loc) · 9.47 KB
/
docker-push.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Docker Image CI
permissions:
packages: write
contents: read
id-token: write
on:
pull_request_target:
types:
- closed
branches:
- 'main'
jobs:
push_to_registry:
if: github.event.pull_request.merged == true
env:
REGISTRY: public.ecr.aws
REGISTRY_ALIAS: b4v4v1s0
IMAGE_TAG: latest
REGION: us-east-1
name: Push Docker image to ECR Public
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
##################################################
################## ECR PUBLIC ####################
##################################################
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master # More information on this action can be found below in the 'AWS Credentials' section
with:
role-to-assume: arn:aws:iam::808326389482:role/automation
aws-region: us-east-1
- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
###############################
###### Docker Image: #######
###### RUBY #######
###############################
- name: Build, tag, and push docker image to Amazon ECR Public - Ruby
if: contains(github.event.pull_request.labels.*.name, 'Ruby')
env:
REPOSITORY: ruby
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
###### Docker Image: #######
###### PYTHON #######
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - Python
if: contains(github.event.pull_request.labels.*.name, 'Python')
env:
REPOSITORY: python
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### JAVASCRIPT v3 ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - JavaScript
if: contains(github.event.pull_request.labels.*.name, 'Javascript-v3')
env:
REPOSITORY: javascriptv3
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### RUST ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - Rust
if: contains(github.event.pull_request.labels.*.name, 'Rust')
env:
REPOSITORY: rust_dev_preview
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### GO v2 ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - GoLang
if: contains(github.event.pull_request.labels.*.name, 'Go-v2')
env:
REPOSITORY: gov2
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### C++ ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - C++
if: contains(github.event.pull_request.labels.*.name, 'C++')
env:
REPOSITORY: cpp
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### .NET v3 ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - .NET v3
if: contains(github.event.pull_request.labels.*.name, 'DotNet-v3')
env:
REPOSITORY: dotnetv3
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### JAVA v2 ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - JavaV2
if: contains(github.event.pull_request.labels.*.name, 'Java-v2')
env:
REPOSITORY: javav2
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### KOTLIN ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - Kotlin
if: contains(github.event.pull_request.labels.*.name, 'Kotlin')
env:
REPOSITORY: kotlin
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### PHP ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - PHP
if: contains(github.event.pull_request.labels.*.name, 'PHP')
env:
REPOSITORY: php
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true
#################################
####### Docker Image: ########
####### SWIFT ########
#################################
- name: Build, tag, and push docker image to Amazon ECR Public - Swift
if: contains(github.event.pull_request.labels.*.name, 'Swift')
env:
REPOSITORY: swift
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY/$REGISTRY_ALIAS
docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
continue-on-error: true