Skip to content

Commit

Permalink
추가: xptmxm
Browse files Browse the repository at this point in the history
  • Loading branch information
rrosiee committed Jul 9, 2024
1 parent 2768295 commit 7aa2e28
Showing 1 changed file with 41 additions and 37 deletions.
78 changes: 41 additions & 37 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,44 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- 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
run: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- name: Build and push Docker image
id: build-image
run: |
IMAGE_TAG=$(date +%Y%m%d%H%M)
docker build -t public.ecr.aws/h7p2f6d8/ticats_ai:$IMAGE_TAG .
docker tag public.ecr.aws/h7p2f6d8/ticats_ai:$IMAGE_TAG public.ecr.aws/h7p2f6d8/ticats_ai:latest
docker push public.ecr.aws/h7p2f6d8/ticats_ai:$IMAGE_TAG
docker push public.ecr.aws/h7p2f6d8/ticats_ai:latest
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: Deploy to EC2
run: |
ssh -o StrictHostKeyChecking=no -i ${{ secrets.EC2_SSH_KEY }} ec2-user@${{ secrets.EC2_INSTANCE_IP }} << 'EOF'
docker pull public.ecr.aws/h7p2f6d8/ticats_ai:latest
docker-compose down
docker-compose up -d
EOF
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- name: Checkout code
uses: actions/checkout@v2

- name: Deploy to EC2
run: |
ssh -o StrictHostKeyChecking=no -i ${{ secrets.EC2_SSH_KEY }} ec2-user@${{ secrets.EC2_INSTANCE_IP }} << 'EOF'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- 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
run: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- name: Build and push Docker image
id: build-image
run: |
IMAGE_TAG=$(date +%Y%m%d%H%M)
docker build -t public.ecr.aws/h7p2f6d8/ticats_ai:$IMAGE_TAG .
docker tag public.ecr.aws/h7p2f6d8/ticats_ai:$IMAGE_TAG public.ecr.aws/h7p2f6d8/ticats_ai:latest
docker push public.ecr.aws/h7p2f6d8/ticats_ai:$IMAGE_TAG
docker push public.ecr.aws/h7p2f6d8/ticats_ai:latest
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: Deploy to EC2
run: |
ssh -o StrictHostKeyChecking=no -i ${{ secrets.EC2_SSH_KEY }} ec2-user@${{ secrets.EC2_INSTANCE_IP }} << 'EOF'
docker pull public.ecr.aws/h7p2f6d8/ticats_ai:latest
docker-compose down
docker-compose up -d
EOF
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

0 comments on commit 7aa2e28

Please sign in to comment.