Skip to content

Backend CD

Backend CD #1

Workflow file for this run

name: Backend CD
on:
issues:
types: [opened, edited, milestoned]
jobs:
build:
runs-on: self-hosted
steps:
# 해당 레포의 소스코드가 작업 환경에 복제된다 , checkout 의 2번째 버젼 사용
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to docker
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password : ${{ secrets.DOCKER_PASSWORD }}
- name: Set env
run: |
echo "DB_HOST=${{ secrets.DB_HOST }}" >> envs/prod.env
echo "DB_PORT=${{ secrets.DB_PORT }}" >> envs/prod.env
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> envs/prod.env
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> envs/prod.env
echo "DB_DATABASE=${{ secrets.DB_DATABASE }}" >> envs/prod.env
- name: Build docker image
uses: docker/[email protected]
with:
tags: rankin:latest
deploy:
needs: build
runs-on: self-hosted
steps:
- name: Stop docker
run: |
docker stop rankin && docker rm rankin
- name: Run docker
run: |
docker run --name rankin -d -p 3000:3000 -v /var/rankin/logs:/app/logs rankin:latest