Skip to content

Commit

Permalink
Merge pull request #19 from KUSITMS-29th-TEAM-B/feat/flight-17
Browse files Browse the repository at this point in the history
Feat: 배포 방식 변경
  • Loading branch information
whereami2048 authored May 7, 2024
2 parents e342b19 + fa95510 commit e952046
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 105 deletions.
File renamed without changes.
12 changes: 12 additions & 0 deletions .deploy/docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
deploy:
container_name: flight
image: ${DOCKER_USERNAME}/${DOCKER_REPOSITORY}
expose:
- 8080
ports:
- "8080:8080"
environment:
- DB_URL=${DB_URL}
- DB_USERNAME=${DB_USERNAME}
- DB_PASSWORD=${DB_PASSWORD}
29 changes: 9 additions & 20 deletions .github/workflows/CD-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CD-dev

on:
push:
branches: [ "main" ]
branches: [ "feat/flight-17" ]

permissions:
contents: read
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
echo "DB_URL=${{ secrets.DEV_DB_URL }}" >> ./.env
echo "DB_USERNAME=${{ secrets.DEV_DB_USERNAME }}" >> ./.env
echo "DB_PASSWORD=${{ secrets.DEV_DB_PASSWORD }}" >> ./.env
# echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> ./.env
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> ./.env
# echo "KAKAO_APP_ID=${{ secrets.KAKAO_APP_ID }}" >> ./.env
# echo "APPLE_APP_ID=${{ secrets.APPLE_APP_ID }}" >> ./.env
# echo "S3_BUCKET=${{ secrets.S3_BUCKET }}" >> ./.env
Expand All @@ -62,28 +62,17 @@ jobs:
- name: docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} .
docker build -f ./.deploy/Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} .
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}
## deploy.sh 파일 서버로 전달
- name: Send deploy.sh
uses: appleboy/scp-action@master
with:
username: ubuntu
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
port: 22
source: "./scripts/"
target: "/home/ubuntu/"

- name: Send docker-compose.yml
uses: appleboy/scp-action@master
with:
username: ubuntu
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
port: 22
source: "./docker-compose.yml"
source: "./.deploy/docker-compose-dev.yml"
target: "/home/ubuntu/"

## 도커 허브에서 jar파일 및 pull후에 컴포즈 up
Expand All @@ -94,8 +83,8 @@ jobs:
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}
chmod 777 ./scripts/deploy.sh
cp ./scripts/deploy.sh ./deploy.sh
./deploy.sh
docker image prune -f
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}
docker compose stop ${{secrets.DOCKER_REPOSITORY}}
docker compose rm -f ${{secrets.DOCKER_REPOSITORY}}
docker compose -f docker-compose-dev.yml up -d
docker image prune -f
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.bamyanggang.apimodule.domain.auth.presentation
import com.bamyanggang.apimodule.domain.auth.application.dto.SocialLogin
import com.bamyanggang.apimodule.domain.auth.application.service.AuthService
import com.bamyanggang.domainmodule.domain.auth.enum.SocialLoginProvider
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
Expand All @@ -18,5 +19,4 @@ class AuthController(
@PathVariable provider: SocialLoginProvider,
@RequestBody request: SocialLogin.Request
): SocialLogin.Response = authService.executeSocialLogin(provider,request)

}
8 changes: 7 additions & 1 deletion Api-Module/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ spring:
open-in-view: false
hibernate:
ddl-auto: update
database-platform: org.hibernate.dialect.MySQLDialect
database-platform: org.hibernate.dialect.MySQLDialect

jwt:
secret: ${JWT_SECRET}
access-token-expiration-time: 3600000 # 60*60*1000 = 1시간
refresh-token-expiration-time: 604800000 # 7*24*60*60*1000 = 7일
registration-token-expiration-time: 1000
24 changes: 0 additions & 24 deletions docker-compose.yml

This file was deleted.

59 changes: 0 additions & 59 deletions scripts/deploy.sh

This file was deleted.

0 comments on commit e952046

Please sign in to comment.