-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 246cd93
Showing
28 changed files
with
984 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,81 @@ | ||
# 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: Nanal Backend | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
#JDK 세팅 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
#gradle Caching | ||
- name: Gradle Cashing | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
#CI | ||
#gradle 권한 추가 | ||
- name: Grant Execute Permission For Gradlew | ||
run: chmod +x gradlew | ||
#빌드(테스트 스킵) | ||
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
## properties 설정 | ||
- name: create application-prod.yml | ||
if: contains(github.ref, 'main') | ||
run: | | ||
cd ./src/main/resources | ||
touch ./application-prod.yml | ||
echo "${{ secrets.PROPERTIES_PROD }}" > ./application-prod.yml | ||
shell: bash | ||
##CD | ||
#빌드(테스트 스킵) | ||
- name: Build With Gradle | ||
if: contains(github.ref, 'main') | ||
run: ./gradlew build -x test | ||
#도커 빌드 & 푸시 | ||
- name: docker build and push | ||
if: contains(github.ref, 'main') | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -f Dockerfile-prod -t ${{ secrets.DOCKER_USERNAME }}/mediflix . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/mediflix | ||
#배포 | ||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
id: deploy-prod | ||
if: contains(github.ref, 'main') | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
envs: GITHUB_SHA | ||
script: | | ||
sudo docker rm -f $(docker ps -qa) | ||
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/mediflix | ||
docker-compose up -d | ||
docker image prune -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 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### CUSTOM ### | ||
application-prod.yml | ||
|
||
### 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:11-jdk | ||
ARG JAR_FILE=./build/libs/mediflix-0.0.1-SNAPSHOT.jar | ||
COPY ${JAR_FILE} app.jar | ||
ENTRYPOINT [ "java", "-jar", "-Dspring.profiles.active=dev", "/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,4 @@ | ||
FROM openjdk:11-jdk | ||
ARG JAR_FILE=./build/libs/mediflix-0.0.1-SNAPSHOT.jar | ||
COPY ${JAR_FILE} app.jar | ||
ENTRYPOINT [ "java", "-jar", "-Dspring.profiles.active=prod", "/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,2 @@ | ||
# BackEnd | ||
큐시즘 27기 기업 프로젝트 동아 ST 대시보드 과제 백엔드 |
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,38 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '2.7.5' | ||
id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||
} | ||
|
||
group = 'com.mediflix' | ||
version = '0.0.1-SNAPSHOT' | ||
sourceCompatibility = '11' | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
developmentOnly 'org.springframework.boot:spring-boot-devtools' | ||
implementation 'mysql:mysql-connector-java' | ||
implementation 'mysql:mysql-connector-java:8.0.31' | ||
implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client' | ||
implementation 'org.springframework.boot:spring-boot-starter-jdbc' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
} | ||
|
||
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,12 @@ | ||
version: '3' | ||
services: | ||
spring-boot: | ||
container_name: medi-server | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-dev | ||
restart: always | ||
environment: | ||
- TZ=Asia/Seoul | ||
ports: | ||
- "8080:8080" |
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,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 |
Oops, something went wrong.