Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(actions): add Deployment workflow #42

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading