Skip to content

Commit

Permalink
Merge pull request #13 from GDSC-KNU/feat/ci-cd
Browse files Browse the repository at this point in the history
배포 과정 환경변수 오류 설정.
  • Loading branch information
fanta4715 authored May 16, 2024
2 parents db95abf + f6787d2 commit 216bc36
Showing 4 changed files with 16 additions and 13 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Java CI with Gradle
name: SpringBoot deploy with Docker

on:
# after merge to main with pr
@@ -22,13 +22,6 @@ jobs:

- name: Build with Gradle Wrapper
run: ./gradlew build -x test
env:
REDIS_HOST: ${{ secrets.REDIS_HOST }}
REDIS_PORT: ${{ secrets.REDIS_PORT }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}

- name: Login to Docker Hub
uses: docker/login-action@v2
@@ -43,7 +36,11 @@ jobs:
- name: Modify docker-compose.dev.yaml
run: |
sed -i "s|REPLACE_IMAGE_TAG|${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}|g" docker-compose.dev.yaml
sed -i "s|REPLACE_IMAGE_TAG|${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}|g" docker-compose.dev.yaml &&
sed -i "s|REPLACE_GOOGLE_CLIENT_ID|${{ secrets.GOOGLE_CLIENT_ID }}|g" docker-compose.dev.yaml &&
sed -i "s|REPLACE_GOOGLE_CLIENT_SECRET|${{ secrets.GOOGLE_CLIENT_SECRET }}|g" docker-compose.dev.yaml &&
sed -i "s|REPLACE_GOOGLE_REDIRECT_URI|${{ secrets.GOOGLE_REDIRECT_URI }}|g" docker-compose.dev.yaml &&
sed -i "s|REPLACE_JWT_SECRET|${{ secrets.JWT_SECRET }}|g" docker-compose.dev.yaml
- name: Send script to remote server
uses: appleboy/scp-action@master
@@ -63,7 +60,7 @@ jobs:
script: |
cd /home/${{ secrets.REMOTE_USERNAME }}/gdsc-project/script
chmod +x deploy.sh
./deploy.sh
sudo ./deploy.sh
dependency-submission:
runs-on: ubuntu-latest
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Java CI with Gradle
name: SpringBoot test with Redis

on:
# after merge to main with pr
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ "develop" ]
7 changes: 7 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -9,6 +9,13 @@ services:

gradingx-server:
image: REPLACE_IMAGE_TAG
environment:
- REDIS_HOST=localhost
- REDIS_PORT=6379
- GOOGLE_CLIENT_ID=REPLACE_GOOGLE_CLIENT_ID
- GOOGLE_CLIENT_SECRET=REPLACE_GOOGLE_CLIENT_SECRET
- GOOGLE_REDIRECT_URI=REPLACE_GOOGLE_REDIRECT_URI
- JWT_SECRET=REPLACE_JWT_SECRET
ports:
- "8080:8080"
depends_on:
2 changes: 1 addition & 1 deletion script/deploy.sh
Original file line number Diff line number Diff line change
@@ -4,4 +4,4 @@ cd ..

docker-compose -f docker-compose.dev.yaml up --build -d

docker-compose ps
docker-compose -f docker-compose.dev.yaml ps

0 comments on commit 216bc36

Please sign in to comment.