Skip to content

[BE] ♻️ : swagger 수정(github action test) (#119) #26

[BE] ♻️ : swagger 수정(github action test) (#119)

[BE] ♻️ : swagger 수정(github action test) (#119) #26

Workflow file for this run

name: Music Spot Project
on:
push:
branches: ["BE/release"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
cd BE/musicspot
docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_TOKEN}}
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:${{github.sha}} ./
docker images
docker push ${{secrets.DOCKER_USERNAME}}/${{secrets.DOCKER_REPO}}:${{github.sha}}
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
cd compose
sudo docker rm -f $(sudo docker ps -qa)
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }}
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:${{github.sha}}
sudo docker tag ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:${{github.sha}} ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO}}:latest
sudo docker compose up -d
sudo docker image prune -af