Skip to content

Commit

Permalink
Merge pull request #42 from lordgrim18/build
Browse files Browse the repository at this point in the history
feat(actions): add Deployment workflow
  • Loading branch information
lordgrim18 authored Jul 10, 2024
2 parents 6929784 + 030964a commit 1e2ba9d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 6 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules

.env
.git
.gitignore

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/CD_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy doker image to Amazon ECR

on:
workflow_run:
workflows: ["Deploy doker image to Amazon ECR"]
types:
- completed

env:
AWS_REGION: ${{ secrets.AWS_REGION }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}

jobs:
deploy:
name: Deploy
runs-on: self-hosted

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Move to the directory containing the Dockerfile
run: cd ./app/Key-Ring

- name: Update git branch
run: git pull origin prod

- name: Update Deployment
run: make deploy
2 changes: 1 addition & 1 deletion .github/workflows/ECR_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy doker image to Amazon ECR

on:
push:
branches: [ "main" ]
branches: [ "prod" ]

env:
AWS_REGION: ${{ secrets.AWS_REGION }}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

/data

.env
.env

.vscode
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ services:

mongo:
image: mongo:latest
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
env_file:
- ./.env
volumes:
- mongo-data:/data/db

Expand Down

0 comments on commit 1e2ba9d

Please sign in to comment.