env added to EB2 #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to ECR and Elastic Beanstalk | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build and push Docker images to ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
run: | | |
# Build and Push Backend Image | |
docker build -t $ECR_REGISTRY/community-backend:latest -f backend/dockerfile ./backend | |
docker push $ECR_REGISTRY/community-backend:latest | |
# Build and Push Frontend Image | |
docker build -t $ECR_REGISTRY/community-frontend:latest -f frontend/dockerfile ./frontend | |
docker push $ECR_REGISTRY/community-frontend:latest | |
- name: Deploy Backend to Elastic Beanstalk | |
uses: einaregilsson/beanstalk-deploy@v21 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: david-kakao-community | |
environment_name: David-kakao-community-env-backend | |
version_label: "backend-${{ github.sha }}-${{ github.run_number }}" | |
region: ap-northeast-2 | |
deployment_package: backend/Dockerrun.aws.json | |
wait_for_environment_recovery: 300 | |
- name: Deploy Frontend to Elastic Beanstalk | |
uses: einaregilsson/beanstalk-deploy@v21 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: david-kakao-community | |
environment_name: David-kakao-community-env-front | |
version_label: "frontend-${{ github.sha }}-${{ github.run_number }}" | |
region: ap-northeast-2 | |
deployment_package: frontend/Dockerrun.aws.json | |
wait_for_environment_recovery: 300 |