Skip to content

feat : menu content 상대 시간 추가 #12

feat : menu content 상대 시간 추가

feat : menu content 상대 시간 추가 #12

Workflow file for this run

name: Deploy backend to EC2
on:
push:
paths:
- "backend/**"
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create .env file
run: |
echo "DB_HOST=${{ secrets.DB_HOST }}" > ./backend/.env
echo "DB_USER=${{ secrets.DB_USER }}" >> ./backend/.env
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> ./backend/.env
echo "DB_NAME=${{ secrets.DB_NAME }}" >> ./backend/.env
echo "DB_PORT=${{ secrets.DB_PORT }}" >> ./backend/.env
echo "PORT=${{ secrets.PORT }}" >> ./backend/.env
echo "CORS_ORIGIN=${{ secrets.CORS_ORIGIN }}" >> ./backend/.env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/worry-is-bubble:latest ./backend
docker push ${{ secrets.DOCKER_USERNAME }}/worry-is-bubble:latest
- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
docker pull ${{ secrets.DOCKER_USERNAME }}/worry-is-bubble:latest
docker stop worry-is-bubble || true
docker rm worry-is-bubble || true
docker run -d --name worry-is-bubble -p 3000:3000 ${{ secrets.DOCKER_USERNAME }}/worry-is-bubble:latest