-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.6 KB
/
DockerImage.yml
File metadata and controls
48 lines (41 loc) · 1.6 KB
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
name: Docker Build and Push
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Make .env.production
run: |
touch ./.env.production
echo "${{ secrets.ENV_PROD }}" > ./.env.production
shell: bash
- name: Login to DockerHub
if: contains(github.ref, 'develop')
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push Docker image
if: contains(github.ref, 'develop')
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_REPO }}:${{ secrets.TAG }}
- name: Deploy IAM Access
if: contains(github.ref, 'develop')
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DEPLOY_IAM_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEPLOY_IAM_SECRET_ACCESS_KEY_ID }}
aws-region: ${{ secrets.REGION }}
- name: Code Deploy
if: contains(github.ref, 'develop')
run: aws deploy create-deployment --application-name ${{ secrets.DEPLOY_APPLICATION_NAME }} --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name ${{ secrets.DEPLOY_GROUP }} --s3-location bucket=${{ secrets.DEPLOY_S3_BUCKET }},key=${{ secrets.DEPLOY_S3_KEY }},bundleType=zip