Skip to content

Merge branch 'dev' into prod #120

Merge branch 'dev' into prod

Merge branch 'dev' into prod #120

name: pyconkr-2023-prod-docker-deploy
on:
push:
branches:
- prod
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy-docker-prod:
if: github.repository_owner == 'pythonkr'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: prod
# - name: setup node
# uses: actions/setup-node@v1
# with:
# node-version: 18.x
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
aws-region: ap-northeast-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: pyconkr-2023/frontend
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build --build-arg ENV=prod -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:prod .
docker push --all-tags $ECR_REGISTRY/$ECR_REPOSITORY
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: task-definition-prod.json
service: pyconkr2023-frontend-prod
cluster: pyconkr-2023-frontend-dev
wait-for-service-stability: true