Skip to content

chore: deploy test

chore: deploy test #39

Workflow file for this run

name: CD
on:
push:
branches: [dev-be]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout...
uses: actions/checkout@v3
- name: Docker Login
run: docker login -u ${{ secrets.DOCKER_ID }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker
run: |
cd BE
docker build -f Dockerfile -t yaongmeow/skkuse-docker .
- name: Push Docker
run: |
cd BE
docker push yaongmeow/skkuse-docker:latest
- name: SSH Login
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: |
docker login --username ${{ secrets.DOCKER_ID }} --password ${{ secrets.DOCKER_PASSWORD }}
docker pull yaongmeow/skkuse-docker
docker stop skkuse-container || true
docker rm skkuse-container || true
docker run -e DB_HOST=${{ secrets.DB_HOST }} \
-e DB_PORT=${{ secrets.DB_PORT }} \
-e DB_USER=${{ secrets.DB_USER }} \
-e DB_PASS=${{ secrets.DB_PASS }} \
-e DB_NAME=${{ secrets.DB_NAME }} \
-e JWT_SECRET_ACCESS=${{ secrets.JWT_SECRET_ACCESS }} \
-e JWT_SECRET_REFRESH=${{ secrets.JWT_SECRET_REFRESH }} \
-e CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} \
-e API_KEY=${{ secrets.API_KEY }} \
-d -p ${{secrets.EXTERNAL_PORT}}:${{secrets.INTERNAL_PORT}} \
-v /root/logs:/workspace/logs \
--name skkuse-container yaongmeow/skkuse-docker \
uvicorn main:app --host=0.0.0.0 --port=${{secrets.INTERNAL_PORT}} --reload