diff --git a/.dockerignore b/.dockerignore index c92dc69..29fc99c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,5 @@ node_modules -.env .git .gitignore diff --git a/.github/workflows/CD_workflow.yml b/.github/workflows/CD_workflow.yml new file mode 100644 index 0000000..c25c619 --- /dev/null +++ b/.github/workflows/CD_workflow.yml @@ -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 diff --git a/.github/workflows/ECR_workflow.yml b/.github/workflows/ECR_workflow.yml index 57ac09f..cdc0ee7 100644 --- a/.github/workflows/ECR_workflow.yml +++ b/.github/workflows/ECR_workflow.yml @@ -2,7 +2,7 @@ name: Deploy doker image to Amazon ECR on: push: - branches: [ "main" ] + branches: [ "prod" ] env: AWS_REGION: ${{ secrets.AWS_REGION }} diff --git a/.gitignore b/.gitignore index 4ff56fb..df248e3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ /data -.env \ No newline at end of file +.env + +.vscode \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 193e803..3360f35 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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