Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

배포 과정 환경변수 오류 설정. #13

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
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" ]
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion script/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading