Skip to content

Commit

Permalink
Merge pull request #44 from SWM-KAWAI-MANS/develop
Browse files Browse the repository at this point in the history
1.0.0 배포
  • Loading branch information
phjppo0918 authored Sep 24, 2023
2 parents 9a01d61 + 89c1884 commit ad7990e
Show file tree
Hide file tree
Showing 81 changed files with 3,127 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build-docker-image-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build Backend Image Dev

on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_PASSWORD:
required: true
DOCKER_AUTHENTICATION_IMAGE_NAME:
required: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: '17'
distribution: 'temurin'

- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Build with jib
run: ./gradlew jib --image="${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_AUTHENTICATION_IMAGE_NAME }}"
37 changes: 37 additions & 0 deletions .github/workflows/build-docker-image-prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build Backend Image Prd

on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_PASSWORD:
required: true
PRD_DOCKER_AUTHENTICATION_IMAGE_NAME:
required: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: '17'
distribution: 'temurin'

- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Build with jib
run: ./gradlew jib --image="${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PRD_DOCKER_AUTHENTICATION_IMAGE_NAME }}"
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: build gradle

on:
pull_request:
branches: [ main, develop ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
32 changes: 32 additions & 0 deletions .github/workflows/cd-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name : cd -dev

on:
push:
branches:
- develop

jobs:
build-back-docker-img:
uses: ./.github/workflows/build-docker-image-dev.yml
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKER_AUTHENTICATION_IMAGE_NAME: ${{ secrets.DOCKER_AUTHENTICATION_IMAGE_NAME }}

deploy:
needs: build-back-docker-img
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.DEV_HOST_USER_NAME }}
key: ${{ secrets.DEV_PRIVATE_KEY }}
script: |
cd ${{ secrets.DEV_DEPLOY_DIRECTORY }}
docker compose stop ${{ secrets.DOCKER_AUTHENTICATION_CONTAINER_NAME }}
docker compose rm -f ${{ secrets.DOCKER_AUTHENTICATION_CONTAINER_NAME }}
docker image rm ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_AUTHENTICATION_IMAGE_NAME }}
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_AUTHENTICATION_IMAGE_NAME }}
docker compose up -d
32 changes: 32 additions & 0 deletions .github/workflows/cd-prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name : cd - prd

on:
push:
branches:
- main

jobs:
build-back-docker-img:
uses: ./.github/workflows/build-docker-image-prd.yml
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
PRD_DOCKER_AUTHENTICATION_IMAGE_NAME: ${{ secrets.PRD_DOCKER_AUTHENTICATION_IMAGE_NAME }}

deploy:
needs: build-back-docker-img
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRD_HOST }}
username: ${{ secrets.PRD_HOST_USER_NAME }}
key: ${{ secrets.PRD_PRIVATE_KEY }}
script: |
cd ${{ secrets.PRD_DEPLOY_DIRECTORY }}
docker compose stop ${{ secrets.PRD_DOCKER_AUTHENTICATION_CONTAINER_NAME }}
docker compose rm -f ${{ secrets.PRD_DOCKER_AUTHENTICATION_CONTAINER_NAME }}
docker image rm ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PRD_DOCKER_AUTHENTICATION_IMAGE_NAME }}
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PRD_DOCKER_AUTHENTICATION_IMAGE_NAME }}
docker compose up -d
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

/src/main/resources/config/secret.json
/src/main/generated/
/logs/
112 changes: 112 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.0'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'com.google.cloud.tools.jib' version '3.2.1'
}

group = 'online.partyrun'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

jar {
enabled = false
}

jib {
from {
image = "openjdk:17"
}
to {
tags = ["latest"]
}
container {
jvmFlags = ["-Xms128m", "-Xmx128m"]
}
}


repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}

configurations {
asciidoctorExt
compileOnly {
extendsFrom annotationProcessor
}
}

ext {
set('snippetsDir', file("build/generated-snippets"))
}

test {
outputs.dir snippetsDir
useJUnitPlatform()
}

asciidoctor {
configurations 'asciidoctorExt'
baseDirFollowsSourceFile()
inputs.dir snippetsDir

dependsOn test
}

asciidoctor.doFirst {
delete file('build/resources/main/static/docs')
}

task createDocument(type: Copy) {
dependsOn asciidoctor

from file("${asciidoctor.outputDir}")
into file("build/resources/main/static/docs")
}

bootJar {
dependsOn createDocument
}

dependencyManagement {
imports {
mavenBom 'software.amazon.awssdk:bom:2.20.120'
}
}

dependencies {
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.google.firebase:firebase-admin:9.1.1'
implementation 'com.github.SWM-KAWAI-MANS:jwt-manager:1.4.0'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'com.github.SWM-KAWAI-MANS:spring-security-authorization-manager:1.1.1'
implementation 'com.github.maricn:logback-slack-appender:1.6.1'

implementation platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.2")
implementation 'io.awspring.cloud:spring-cloud-aws-starter-s3'
implementation 'io.awspring.cloud:spring-cloud-aws-starter-sns'


//lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

testImplementation 'com.github.SWM-KAWAI-MANS:test-manager:1.0.2'
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'

//lombok-test
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit ad7990e

Please sign in to comment.