-
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 #27 from FourCut-Diary/develop
RELEASE 2024-12-05 21:39:30
- Loading branch information
Showing
8 changed files
with
162 additions
and
2 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,78 @@ | ||
# 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: API-Server CD | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
ci-workflow: | ||
runs-on: ubuntu-latest | ||
env: | ||
working-directory: ./ | ||
|
||
steps: | ||
|
||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: make application.yml 파일 생성 | ||
run: | | ||
## create application.yml | ||
cd ./module-api/src/main/resources | ||
# application.yml 파일 생성 | ||
touch ./application-prod.yml | ||
# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기 | ||
echo "${{ secrets.FOURCUTDIARY_APPLICATION }}" >> ./application-prod.yml | ||
shell: bash | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build | ||
|
||
- name: docker build 가능하도록 환경 설정 | ||
uses: docker/[email protected] | ||
|
||
- name: docker hub에로그인 | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_LOGIN_USER }} | ||
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESS_TOKEN }} | ||
|
||
- name: docker image 빌드 및 푸시 | ||
run: | | ||
docker build --platform linux/amd64 -t lsh328328/fourcutdiary . | ||
docker push lsh328328/fourcutdiary | ||
working-directory: ${{ env.working-directory }} | ||
|
||
cd-workflow: | ||
needs: ci-workflow | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 도커 컨테이너 실행 | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.RELEASE_SERVER_IP }} | ||
username: ${{ secrets.RELEASE_SERVER_USER }} | ||
key: ${{ secrets.RELEASE_SERVER_KEY }} | ||
script: | | ||
cd ~ | ||
sudo ./deploy.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM amd64/amazoncorretto:17 | ||
|
||
WORKDIR /app | ||
|
||
COPY ./module-api/build/libs/module-api-0.0.1-SNAPSHOT.jar /app/fourcutdiary.jar | ||
|
||
CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active={profile}", "fourcutdiary.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
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
54 changes: 54 additions & 0 deletions
54
module-domain/src/main/java/com/fourcut/diary/diary/Diary.java
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,54 @@ | ||
package com.fourcut.diary.diary; | ||
|
||
import com.fourcut.diary.common.AuditingTimeEntity; | ||
import com.fourcut.diary.user.domain.User; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Diary extends AuditingTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String title; | ||
|
||
@Column(nullable = false) | ||
private LocalDate date; | ||
|
||
@Column | ||
private String firstPicture; | ||
|
||
@Column | ||
private String secondPicture; | ||
|
||
@Column | ||
private String thirdPicture; | ||
|
||
@Column | ||
private String fourthPicture; | ||
|
||
@Column | ||
private String firstComment; | ||
|
||
@Column | ||
private String secondComment; | ||
|
||
@Column | ||
private String thirdComment; | ||
|
||
@Column | ||
private String fourthComment; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
} |