Merge pull request #109 from Central-MakeUs/105-정렬-기준-수정 #5
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: CD for dev | |
on: | |
push: | |
branches: [ "dev" ] | |
jobs: | |
deploy: | |
name: Deploy project | |
runs-on: self-hosted | |
env: | |
working-directory: purithm | |
steps: | |
- name: Push to DockerHub | |
run: | | |
cd ${{ env.working-directory }} | |
ls | |
docker login -u ${{secrets.DOCKERHUB_USERNAME}} -p ${{secrets.DOCKERHUB_TOKEN}} | |
docker build -t ${{secrets.DOCKERHUB_USERNAME}}/${{secrets.DOCKER_REPO}} . | |
docker push ${{secrets.DOCKERHUB_USERNAME}}/${{secrets.DOCKER_REPO}} | |
- name: Pull Docker | |
run: | | |
if sudo docker ps | grep ":8081->8081"; then | |
sudo docker stop $(sudo docker ps -qf "expose=8081") | |
fi | |
sudo docker login -u ${{secrets.DOCKERHUB_USERNAME}} -p ${{secrets.DOCKERHUB_TOKEN}} | |
sudo docker pull ${{secrets.DOCKERHUB_USERNAME}}/${{secrets.DOCKER_REPO}} | |
sudo docker run -d -p 8081:8081 ${{secrets.DOCKERHUB_USERNAME}}/${{secrets.DOCKER_REPO}} | |
sudo docker image prune -f |