Skip to content

Commit

Permalink
Merge pull request #11 from tukcomCD2024/build/#10-backend-cicd
Browse files Browse the repository at this point in the history
Build/#10 backend cicd
  • Loading branch information
yeonjy authored Apr 15, 2024
2 parents b598e90 + 2b626fd commit 2408555
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ permissions:
jobs:
build:
runs-on: ubuntu-22.04
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'Dev-backend'
if: ${{ github.event.pull_request.base.ref == 'Dev-backend' || github.event_name == 'push' }}

steps:
# 지정한 저장소(현재 REPO)에서 코드를 워크플로우 환경으로 가져오도록 하는 github action
- name: Checkout
- uses: actions/checkout@v3

# open jdk 17 버전 환경을 세팅
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: "adopt"
distribution: "temurin"

# Github secrets로부터 데이터를 받아서, 워크 플로우에 파일을 생성
- name: Make application.yml
Expand Down Expand Up @@ -71,5 +72,6 @@ jobs:
script: |
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_REPO }}/backend-dev
docker-compose up -d
docker image prune -f
cd ~/JinJiHan
sudo docker-compose -f docker-compose.yml down
sudo docker-compose -f docker-compose.yml up --build -d
4 changes: 4 additions & 0 deletions backend/core/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM eclipse-temurin:17-jdk-jammy AS build
WORKDIR /app
COPY . /app
CMD ["gradle", "bootRun"]
39 changes: 39 additions & 0 deletions backend/core/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3.9"
services:
redis:
image: redis:latest
container_name: redis
ports:
- "6379:6379"
networks:
backend:
restart: always
tty: true

rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
entrypoint: >
/bin/bash -c "
rabbitmq-server &
sleep 10 && rabbitmq-plugins enable rabbitmq_web_stomp &
tail -f /dev/null
"
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
ports:
- "5672:5672"
- "15672:15672"
volumes:
- data_rabbitmq:/rabbitmq
networks:
- backend
restart: always
tty: true

networks:
backend:

volumes:
data_rabbitmq: null
64 changes: 64 additions & 0 deletions backend/core/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
spring:
datasource:
driver-class-name: ${DRIVER_CLASS_NAME}
url: ${DATASOURCE_URL}
username: ${DATABASE_USERNAME}
password: ${DATABASE_PASSWORD}
jpa:
database-platform: org.hibernate.dialect.MySQLDialect
show-sql: true
hibernate:
ddl-auto: none
security:
oauth2:
client:
registration:
kakao:
client-id: ${KAKAO_CLIENT_ID} #rest api 키 값
client-secret: ${KAKAO_CLIENT_SECRET}
redirect-uri: ${KAKAO_REDIRECT_URI}
client-authentication-method: client_secret_post
authorization-grant-type: authorization_code
client-name: Kakao
scope:
- profile_nickname
- profile_image
- account_email
provider:
kakao:
authorization-uri: ${KAKAO_AUTHORIZATION_URI}
token-uri: ${KAKAO_TOKEN_URI}
user-info-uri: ${KAKAO_USER_INFO_URI}
user-name-attribute: id
data:
redis:
host: ${REDIS_HOST}
port: ${REDIS_PORT}

rabbitmq:
host: ${RABBITMQ_HOST}
port: ${RABBITMQ_PORT}
username: ${RABBITMQ_USERNAME}
password: ${RABBITMQ_PASSWORD}
listener:
simple:
prefetch: 50

jwt:
secret-key: ${JWT_SECRET_KEY}
access:
expiration: 3600000 #1hours
header: Authorization
refresh:
expiration: 604800000 #7days
header: Authorization-refresh

rabbitmq:
summary:
queue.name: ${SUMMARY_QUEUE_NAME}
exchange.name: ${SUMMARY_EXCHANGE_NAME}
routing.key: ${SUMMARY_ROUTING_KEY}
store:
queue.name: ${STORE_QUEUE_NAME}
exchange.name: ${STORE_EXCHANGE_NAME}
routing.key: ${STORE_ROUTING_KEY}
3 changes: 3 additions & 0 deletions backend/core/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spring:
profiles:
active: dev

0 comments on commit 2408555

Please sign in to comment.