Skip to content

Commit

Permalink
#28 [chore] : GCP를 기준으로 CICD 파이프라인을 변경한다
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbang105 committed Sep 13, 2024
1 parent 1367bad commit bff6495
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,29 @@ jobs:
${{ runner.os }}-gradle-
- name: ⏱️gradle build를 위한 권한을 부여합니다.
run: chmod +x gradlew
run: chmod +x ./gradlew

- name: ⏱️gradle build 중입니다.
run: ./gradlew build -x test

- name: ⏱️NCP Container Registry에 로그인 후, docker image build 후 NCP Container Registry에 push합니다.
- name: ⏱️Docker Hub에 로그인합니다.
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: ⏱️Docker image build 후 Docker hub에 push합니다.
run: |
docker login -u ${{ secrets.NCP_API_ACCESS_KEY }} -p ${{ secrets.NCP_API_SECRET_KEY }} ${{secrets.NCP_CONTAINER_REGISTRY_PUBLIC_ENDPOINT}}
docker build -f Dockerfile -t ${{ secrets.NCP_CONTAINER_REGISTRY_PUBLIC_ENDPOINT }}/${{ secrets.NCP_CONTAINER_REGISTRY_IMAGE }} .
docker push ${{ secrets.NCP_CONTAINER_REGISTRY_PUBLIC_ENDPOINT }}/${{ secrets.NCP_CONTAINER_REGISTRY_IMAGE }}
docker build -f Dockerfile -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_IMAGE_NAME }} .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_IMAGE_NAME }}
- name: ️NCP Container Registry에서 pull 후 deploy합니다.
- name: ️Docker hub에서 pull 후 deploy합니다.
uses: appleboy/ssh-action@master
with:
username: ${{ secrets.NCP_SERVER_USERNAME }}
password: ${{ secrets.NCP_SERVER_PASSWORD }}
host: ${{ secrets.NCP_SERVER_HOST }}
port: ${{ secrets.NCP_SERVER_PORT }}
host: ${{ secrets.GCP_SERVER_HOST }}
username: ${{ secrets.GCP_SERVER_USERNAME }}
key: ${{ secrets.GCP_SSH_KEY }}
script: |
chmod 777 ./deploy.sh
sudo chmod 777 ./deploy.sh
./deploy.sh
docker image prune -f
sudo docker image prune -f

0 comments on commit bff6495

Please sign in to comment.