Skip to content

Commit

Permalink
Update github-actions.yml by docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
kylo-dev authored Apr 19, 2024
1 parent 0729ace commit 7f6844a
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Meetfolio CI/CD

on:
push:
branches: [ "main" ]
branches: ["test/docker-compose"]

permissions:
contents: read
Expand All @@ -18,8 +18,8 @@ jobs:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
java-version: "17"
distribution: "temurin"

# 서브 모듈 접근하기
- name: Checkout repo
Expand All @@ -35,7 +35,7 @@ jobs:
# gradlew 권한 변경
- name: Grant execute permission for gradlew
run : chmod +x gradlew
run: chmod +x gradlew

# Gradle Buuild (test 부분 제외)
- name: Build with Gradle
Expand All @@ -50,20 +50,16 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker build and push
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/meetfolio:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/meetfolio:latest
- name: Deploy in GCP
uses: appleboy/ssh-action@master
env:
REDIS_PWD: ${{ secrets.REDIS_PWD }}
COMPOSE: "./docker-compose.yml"
with:
host: ${{ secrets.GCE_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
envs: REDIS_PWD, COMPOSE
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/meetfolio:latest
sudo docker tag ${{ secrets.DOCKER_USERNAME }}/meetfolio:latest meetfolio:latest
sudo docker rm -f meetfolio-server
sudo docker run -d --name meetfolio-server -e TZ=Asia/Seoul -p 9090:9090 meetfolio:latest
docker image prune -af
sudo docker-compose -f $COMPOSE down --rmi all
sudo docker-compose -f $COMPOSE up -d

0 comments on commit 7f6844a

Please sign in to comment.