This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
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.
Merge pull request #46 from gdsc-konkuk/develop
1차 MVP
- Loading branch information
Showing
41 changed files
with
671 additions
and
203 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,47 @@ | ||
name: Continuous Delivery | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
Delivery: | ||
runs-on: ubuntu-22.04 | ||
|
||
env: | ||
DB_URL: ${{ secrets.DB_URL }} | ||
DB_USER: ${{ secrets.DB_USR }} | ||
DB_PASSWORD: ${{ secrets.DB_PWD }} | ||
|
||
steps: | ||
- name: Set up sources | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
submodules: true | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
distribution: corretto | ||
cache: gradle | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Execute Gradle build | ||
run: ./gradlew build | ||
|
||
- name: Login to docker-hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build Docker Image | ||
run: docker build --tag goldentrash/plantory:latest . | ||
|
||
- name: Push docker image | ||
run: docker push goldentrash/plantory:latest |
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,33 @@ | ||
name: Deploy | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
Deploy: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
# Needed for `google-github-actions` | ||
- uses: 'actions/checkout@v4' | ||
|
||
- name: Login to Google | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | ||
|
||
- name: Update docker container | ||
uses: google-github-actions/ssh-compute@v1 | ||
with: | ||
instance_name: plantory | ||
zone: asia-northeast3-a | ||
ssh_private_key: ${{ secrets.GCP_SSH_KEY }} | ||
command: | | ||
docker pull goldentrash/plantory:latest | ||
docker stop plantory | ||
docker run -d --rm -p 8080:8080 --mount type=volume,src=resources,dst=/app/resources --name plantory goldentrash/plantory |
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,9 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM amazoncorretto:17-alpine | ||
|
||
WORKDIR /app | ||
COPY /build/libs/plantory-*-SNAPSHOT.jar app.jar | ||
|
||
EXPOSE 8080 | ||
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
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/gdsc/plantory/common/config/SwaggerConfig.kt
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,20 @@ | ||
package gdsc.plantory.common.config | ||
|
||
import gdsc.plantory.common.support.AccessDeviceToken | ||
import gdsc.plantory.common.support.DEVICE_ID_HEADER | ||
import io.swagger.v3.oas.models.Operation | ||
import io.swagger.v3.oas.models.security.SecurityRequirement | ||
import org.springdoc.core.customizers.OperationCustomizer | ||
import org.springframework.stereotype.Component | ||
import org.springframework.web.method.HandlerMethod | ||
|
||
@Component | ||
class Operation : OperationCustomizer { | ||
override fun customize(operation: Operation?, handlerMethod: HandlerMethod?): Operation? { | ||
if (handlerMethod?.methodParameters?.find { it.hasParameterAnnotation(AccessDeviceToken::class.java) } != null) { | ||
operation?.addSecurityItem(SecurityRequirement().addList(DEVICE_ID_HEADER)) | ||
} | ||
|
||
return operation | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
src/main/kotlin/gdsc/plantory/common/support/AccessDeviceToken.kt
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
package gdsc.plantory.common.support | ||
|
||
import io.swagger.v3.oas.annotations.Parameter | ||
import io.swagger.v3.oas.annotations.enums.ParameterIn | ||
|
||
@Target(AnnotationTarget.VALUE_PARAMETER) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@Parameter(`in` = ParameterIn.HEADER, name = DEVICE_ID_HEADER, description = "사용자 디바이스/인증 토큰") | ||
annotation class AccessDeviceToken |
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
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
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
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
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
Oops, something went wrong.