diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..115e95a
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,60 @@
+name: deploy-actions
+
+on:
+ push:
+ branches: [ "main" ]
+
+jobs:
+ ci:
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ token: ${{ secrets.GIT_TOKEN }}
+ submodules: true
+
+ - 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 clean build -x test
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
+
+ - name: Build and push
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./Dockerfile
+ push: true
+ tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_PROD_REPONAME }}:0.0.1
+
+ cd:
+ needs: [ci]
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Docker Image Pull And Container Run
+ uses: appleboy/ssh-action@v1.0.0
+ with:
+ key: ${{ secrets.SSH_PRIVATE_KEY }}
+ host: ${{ secrets.SSH_HOST }}
+ username: ${{ secrets.SSH_USERNAME }}
+ port: ${{ 22 }}
+ script: |
+ sh /home/ubuntu/deploy.sh
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 689b61e..85dc4a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,13 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+# Credentials
+src/main/resources/application-prod.yml
+src/main/resources/application-local.yml
+
+.idea
+HELP.md
+
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..8f012ab
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "startup-valley-properties"]
+ path = startup-valley-properties
+ url = https://github.com/JeongHeumChoi/spot-server-properties.git
+ branch = main
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 13566b8..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index 748eb4a..0000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-spot
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index d383f9f..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
deleted file mode 100644
index fdc392f..0000000
--- a/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 0a91222..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..4b8e1a9
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,4 @@
+FROM openjdk:17-alpine
+ARG JAR_FILE=build/libs/*.jar
+COPY ${JAR_FILE} app.jar
+ENTRYPOINT ["java","-jar","/app.jar", "--spring.profiles.active=prod"]
diff --git a/HELP.md b/HELP.md
deleted file mode 100644
index 5ac2756..0000000
--- a/HELP.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Getting Started
-
-### Reference Documentation
-For further reference, please consider the following sections:
-
-* [Official Gradle documentation](https://docs.gradle.org)
-* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.5/gradle-plugin/reference/html/)
-* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.5/gradle-plugin/reference/html/#build-image)
-* [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#using.devtools)
-* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#web)
-* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#data.sql.jpa-and-spring-data)
-* [Validation](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#io.validation)
-
-### Guides
-The following guides illustrate how to use some features concretely:
-
-* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
-* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
-* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
-* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
-* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
-* [Validation](https://spring.io/guides/gs/validating-form-input/)
-
-### Additional Links
-These additional references should also help you:
-
-* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle)
-
diff --git a/build.gradle b/build.gradle
index 34ff975..ca94c48 100644
--- a/build.gradle
+++ b/build.gradle
@@ -22,14 +22,39 @@ repositories {
}
dependencies {
+ //database
+ implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
- implementation 'org.springframework.boot:spring-boot-starter-validation'
+ runtimeOnly 'com.mysql:mysql-connector-j'
+
+ // spring security
+ implementation 'org.springframework.boot:spring-boot-starter-security'
+ testImplementation 'org.springframework.security:spring-security-test'
+
+ // spring boot
implementation 'org.springframework.boot:spring-boot-starter-web'
- compileOnly 'org.projectlombok:lombok'
+ testImplementation 'org.springframework.boot:spring-boot-starter-test'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
- runtimeOnly 'com.mysql:mysql-connector-j'
+ compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
- testImplementation 'org.springframework.boot:spring-boot-starter-test'
+ implementation 'org.springframework.boot:spring-boot-starter-validation'
+
+ // jwt
+ implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
+ implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
+ runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
+ runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
+
+ //json
+ implementation 'net.minidev:json-smart:2.4.7'
+}
+
+task copyGitSubmodule(type: Copy) {
+ copy {
+ from './spot-server-properties'
+ include '*.yml'
+ into './src/main/resources'
+ }
}
tasks.named('test') {
diff --git a/deploy.sh b/deploy.sh
new file mode 100644
index 0000000..1b80f9d
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+./gradlew clean build -x test
+docker buildx build --platform linux/amd64 --load --tag jeongheumchoi/spot-server:0.0.1 .
+docker push jeongheumchoi/spot-server:0.0.1
+
diff --git a/spot-server-properties b/spot-server-properties
new file mode 160000
index 0000000..6bf7ffc
--- /dev/null
+++ b/spot-server-properties
@@ -0,0 +1 @@
+Subproject commit 6bf7ffcb4dcbb7e8d1797c2b1df3d77944593e89
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 149ada3..4188214 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,14 +1,13 @@
-spring:
- datasource:
- url: "jdbc:mysql://localhost/spot"
- username: "root"
- password: "0731"
- driver-class-name: com.mysql.cj.jdbc.Driver
- jpa:
- hibernate:
- ddl-auto: update
- properties:
- hibernate:
- show_sql: true
- format_sql: true
- dialect: org.hibernate.dialect.MySQL8Dialect
\ No newline at end of file
+spring.profiles.default: local
+
+---
+
+spring.config.activate.on-profile: local
+
+---
+
+spring.config.activate.on-profile: dev
+
+---
+
+spring.config.activate.on-profile: prod