forked from Uarth/Us
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'backend/main'
- Loading branch information
Showing
68 changed files
with
2,559 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
|
||
name: Java CD with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: make database and aws properties | ||
run: | | ||
cd ./src/main/resources | ||
touch database.properties | ||
echo "${{secrets.DATABASE_PROPERTIES}}" >> database.properties | ||
touch aws.properties | ||
echo "${{secrets.AWS_PROPERTIES}}" >> aws.properties | ||
- name: write env file | ||
run: | | ||
cd ./ | ||
touch .env | ||
echo "${{secrets.ENV}}" >> .env | ||
cd ./src/main/resources | ||
touch .env | ||
echo "${{secrets.ENV}}" >> .env | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle Wrapper | ||
run: ./gradlew build -x test | ||
|
||
- name: make application-prod.yml | ||
run: | | ||
cd ./src/main/resources | ||
touch ./application-prod.yml | ||
echo "${{secrets.EC2_HOST}}" > ./application-prod.yml | ||
- name: Docker build | ||
run: | | ||
docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} | ||
docker build -t app . | ||
docker tag app ${{secrets.DOCKER_USERNAME}}/app:latest | ||
docker push ${{secrets.DOCKER_USERNAME}}/app:latest | ||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{secrets.EC2_HOST}} | ||
username: ${{secrets.EC2_USER_NAME}} | ||
key: ${{secrets.PRIVATE_KEY}} | ||
script: | | ||
docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} | ||
docker pull ${{secrets.DOCKER_USERNAME}}/app:latest | ||
docker stop $(docker ps -a -q) | ||
docker rm $(docker ps -a -q) | ||
docker run -d -p 8080:8080 \ | ||
-e SPRING_PROPERTIES_ACTIVE=prod \ | ||
-e AWS_SECRET_ACCESS_KEY=${{secrets.AWS_SECRET_ACCESS_KEY}} \ | ||
-e AWS_ACCESS_KEY_ID=${{secrets.AWS_ACCESS_KEY_ID}} \ | ||
${{secrets.DOCKER_USERNAME}}/app:latest | ||
docker image prune -a -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
src/main/resources/.env | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
**/src/main/resources/*.properties | ||
!**/src/main/resources/*.example.properties | ||
!**/src/main/resources/application.properties | ||
### 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM openjdk:17-alpine | ||
ARG JAR_FILE=build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
ENTRYPOINT ["java", "-jar", "/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Us | ||
|
||
### Build | ||
``` | ||
1. aws.properties & database.properties를 example을 참고하여 추가 | ||
2. s3를 위한 aws credential 설정을 docker-compose.yml에 추가 | ||
3. docker-compose up -d | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.3.0' | ||
id 'io.spring.dependency-management' version '1.1.5' | ||
} | ||
|
||
group = 'ybigta' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
sourceCompatibility = '17' | ||
} | ||
|
||
jar { | ||
enabled=false | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation platform('software.amazon.awssdk:bom:2.21.1') | ||
implementation 'software.amazon.awssdk:s3' | ||
implementation 'software.amazon.awssdk:sso' | ||
implementation 'software.amazon.awssdk:ssooidc' | ||
implementation 'org.projectlombok:lombok' | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
implementation 'mysql:mysql-connector-java:8.0.32' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | ||
implementation'org.springframework.boot:spring-boot-starter-oauth2-client' | ||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' | ||
implementation 'net.nurigo:sdk:4.3.0' | ||
implementation 'io.github.cdimascio:dotenv-java:2.2.0' | ||
implementation 'org.springframework.boot:spring-boot-starter-webflux' | ||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '3' | ||
services: | ||
spring-server: | ||
build: | ||
context: . | ||
dockerfile: remote.Dockerfile | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} | ||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.