-
Notifications
You must be signed in to change notification settings - Fork 1
28 lines (24 loc) · 1.01 KB
/
java.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
name: Publish Docker image
on:
push:
branches:
- main
jobs:
buid_and_publush_dockergiot :
name: Push Docker image to ECR
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Build and push Docker image
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 244530008913.dkr.ecr.eu-west-1.amazonaws.com
rev=$(git rev-parse --short HEAD)
docker build . -t hello
docker tag hello 244530008913.dkr.ecr.eu-west-1.amazonaws.com/vincent-ppe:$rev
docker tag hello 244530008913.dkr.ecr.eu-west-1.amazonaws.com/vincent-ppe:latest
docker push 244530008913.dkr.ecr.eu-west-1.amazonaws.com/vincent-ppe:$rev
docker push 244530008913.dkr.ecr.eu-west-1.amazonaws.com/vincent-ppe:latest