Merge pull request #364 from boostcampwm2023/BE/story/api-versioning_โฆ #90
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: 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_VPC_HOST }} | |
username: ${{ secrets.SERVER_VPC_USERNAME }} | |
key: ${{ secrets.SERVER_VPC_KEY }} | |
port: ${{ secrets.SERVER_VPC_PORT }} | |
script: | | |
mkdir a | |
cd compose | |
echo ${{ secrets.SERVER_VPC_PASSWORD }} | sudo -S docker rm -f $(sudo docker ps -qa) | |
echo ${{ secrets.SERVER_VPC_PASSWORD }} | sudo -S docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }} | |
echo ${{ secrets.SERVER_VPC_PASSWORD }} | sudo -S docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:${{github.sha}} | |
echo ${{ secrets.SERVER_VPC_PASSWORD }} | sudo -S docker tag ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:${{github.sha}} ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO}}:latest | |
echo ${{ secrets.SERVER_VPC_PASSWORD }} | sudo -S docker compose up -d | |
echo ${{ secrets.SERVER_VPC_PASSWORD }} | sudo -S docker image prune -af |