feat: 북마크 목록 조회 API 추가 #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to NCP Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ secrets.CR_REGISTRY }} | |
username: ${{ secrets.CR_USERNAME }} | |
password: ${{ secrets.CR_PASSWORD }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ secrets.CR_REGISTRY }}/paran:latest | |
- name: Connect to NCP Server, pass enviroment, and run docker | |
uses: appleboy/ssh-action@master | |
env: | |
DB_DB: ${{ secrets.DB_DB }} | |
DB_HOST: ${{ secrets.DB_HOST }} | |
DB_USER: ${{ secrets.DB_USER }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_PORT: ${{ secrets.DB_PORT }} | |
CR_REGISTRY: ${{ secrets.CR_REGISTRY }} | |
CR_USERNAME: ${{ secrets.CR_USERNAME }} | |
CR_PASSWORD: ${{ secrets.CR_PASSWORD }} | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: ${{ secrets.SSH_PORT }} | |
envs: DB_DB, DB_HOST, DB_USER, DB_PASSWORD, DB_PORT, CR_REGISTRY, CR_USERNAME, CR_PASSWORD | |
script: | | |
CONTAINERS=$(docker ps -q) | |
if [ -n "$CONTAINERS" ]; then | |
docker stop $CONTAINERS | |
fi | |
STOPPED_CONTAINERS=$(docker ps -a -q) | |
if [ -n "$STOPPED_CONTAINERS" ]; then | |
docker rm $STOPPED_CONTAINERS | |
fi | |
IMAGES=$(docker images -aq) | |
if [ -n "$IMAGES" ]; then | |
docker rmi -f $IMAGES | |
fi | |
docker login -u ${{ secrets.CR_USERNAME }} --password-stdin ${{ secrets.CR_PASSWORD }} ${{ secrets.CR_REGISTRY }} | |
docker pull ${{ secrets.CR_REGISTRY }}/paran:latest | |
docker run \ | |
--rm \ | |
-e DB_DB=${{secrets.DB_DB}} -e DB_HOST=${{secrets.DB_HOST}} \ | |
-e DB_PASSWORD=${{secrets.DB_PASSWORD}} -e DB_PORT=${{secrets.DB_PORT}} \ | |
-e DB_USER=${{secrets.DB_USER}} \ | |
-p 8080:8080 \ | |
-d --name container_name ${{ secrets.CR_REGISTRY }}/paran:latest | |
docker ps |