Skip to content

feat: 좋아요한 게시물에 차단한 사용자가 표시되지 않도록 수정 #130

feat: 좋아요한 게시물에 차단한 사용자가 표시되지 않도록 수정

feat: 좋아요한 게시물에 차단한 사용자가 표시되지 않도록 수정 #130

Workflow file for this run

name: Deploy API Server
on:
push:
branches:
- main
paths:
- 'package.json'
- 'bun.lockb'
- 'tsconfig.json'
- 'Dockerfile'
- 'prisma/**'
- 'src/**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DK_USERNAME }}
password: ${{ secrets.DK_TOKEN }}
- name: Create .env file with Secrets
uses: SpicyPizza/[email protected]
with:
envkey_DATABASE_URL: mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}
envkey_DB_DATABASE: ${{ secrets.DB_DATABASE }}
envkey_DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
envkey_DB_HOST: ${{ secrets.DB_HOST }}
envkey_DB_PORT: ${{ secrets.DB_PORT }}
envkey_DB_USER: ${{ secrets.DB_USER }}
envkey_DK_IMAGE: ${{ secrets.DK_IMAGE }}
envkey_DK_USERNAME: ${{ secrets.DK_USERNAME }}
envkey_NODE_ENV: ${{ secrets.NODE_ENV }}
envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }}
envkey_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
envkey_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
envkey_PORT: ${{ secrets.PORT }}
envkey_TZ: ${{ secrets.TZ }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.DK_USERNAME }}/${{ secrets.DK_IMAGE }}:latest
- name: Deploy Docker to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_KEY }}
script_stop: true
script: |
sudo docker pull mysql:8.1.0
sudo docker pull ${{ secrets.DK_USERNAME }}/${{ secrets.DK_IMAGE }}:latest
sudo docker rm -f ${{ secrets.DK_IMAGE }} || true
sudo docker rm -f ${{ secrets.DK_IMAGE }}-db || true
sudo docker network rm api-network || true
sudo docker network create api-network
sudo docker run --network api-network --name ${{ secrets.DK_IMAGE }}-db \
-e MYSQL_DATABASE=${{ secrets.DB_DATABASE }} -e MYSQL_ROOT_PASSWORD=${{ secrets.DB_PASSWORD }} -e TZ=UTC \
-v mysql-data:/var/lib/mysql -p ${{ secrets.DB_PORT }}:3306 -d mysql:8.1.0
sudo docker run --network api-network --add-host host.docker.internal:host-gateway --name ${{ secrets.DK_IMAGE }} \
--link ${{ secrets.DK_IMAGE }}-db:db -p ${{ secrets.PORT }}:${{ secrets.PORT }} \
-d ${{ secrets.DK_USERNAME }}/${{ secrets.DK_IMAGE }}:latest /home/bun/app/wait-for-db.sh
sudo docker container prune -f || true
sudo docker image prune -f || true