Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9 [feat] CD 워크플로우 구축 #10

Merged
merged 21 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1d3521a
#9 [chore] 빌드 관련 파일 gitignore 설정
sohyundoh Jan 2, 2024
b122018
#9 [chore] 빌드 관련 파일 삭제
sohyundoh Jan 2, 2024
8533e62
#9 [refactor] image 변수명 imageUrl로 변경
sohyundoh Jan 2, 2024
5fe8fcc
#9 [feat] 의존성 파일 버전 변경
sohyundoh Jan 2, 2024
4b51745
#9 [feat] spring actuator 의존성 추가
sohyundoh Jan 2, 2024
59f0cc4
#9 [feat] Dockerfile 작성
sohyundoh Jan 2, 2024
066e321
#9 [chore] CD 워크플로우 파일 작성
sohyundoh Jan 2, 2024
b5fc333
#9 [chore] CD 워크플로우 파일 작성
sohyundoh Jan 2, 2024
3a3bf51
#9 [feat] CD 워크플로우 pull request 시로 수정
sohyundoh Jan 2, 2024
0fbfb07
#9 [feat] CD 워크플로우 환경 변수명 수정
sohyundoh Jan 2, 2024
d3f118b
#9 [feat] mysql 의존성 추가
sohyundoh Jan 2, 2024
32f7821
#9 [feat] CD 워크플로우 디렉토리 설정
sohyundoh Jan 2, 2024
deb64c0
#9 [feat] application.yml 파일명 변경
sohyundoh Jan 2, 2024
6a82fc8
#9 [chore] CD 워크플로우 파일 수정
sohyundoh Jan 2, 2024
d504506
#9 [feat] CD 워크플로우 파일 수정
sohyundoh Jan 2, 2024
3ae7b94
#9 [chore] CD 워크플로우 파일 수정
sohyundoh Jan 2, 2024
524b775
#9 [feat] DB 의존성 변경
sohyundoh Jan 3, 2024
1f9cee6
#9 [feat] CD 워크플로우 파일 수정
sohyundoh Jan 3, 2024
f33a647
#9 [feat] 도커 파일 수정
sohyundoh Jan 3, 2024
5ab72e2
Merge branch 'feat/#9' of https://github.com/Mile-Writings/Mile-Serve…
sohyundoh Jan 3, 2024
fa28841
#9 [feat] Dockerfile profile 변수 수정
sohyundoh Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/PROD-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CD

on:
pull_request:
branches: [ "develop" ]

jobs:
deploy-ci:
runs-on: ubuntu-22.04
env:
working-directory: .


steps:
- name: 체크아웃
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'

- name: application.yaml 생성
run: |
mkdir ./module-api/src/main/resources
cd ./module-api/src/main/resources
touch ./application.yml
echo "${{ secrets.PROD_APPLICATION }}" > ./application.yml
cat ./application.yml
working-directory: ${{ env.working-directory }}

- name: 빌드
run: |
chmod +x gradlew
./gradlew build -x test
working-directory: ${{ env.working-directory }}
shell: bash


- name: docker build 환경 설정
uses: docker/[email protected]

- name: login docker hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_SECRET }}

- name: docker image 빌드 및 푸시
run: |
docker build --platform linux/amd64 -t mile1217/mile-server .
docker push mile1217/mile-server
working-directory: ${{ env.working-directory }}

deploy-cd:
needs: deploy-ci
runs-on: ubuntu-22.04

steps:
- name: 도커 컨테이너 실행
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_SERVER_IP }}
username: ${{ secrets.PROD_SERVER_USER }}
key: ${{ secrets.PROD_SERVER_KEY }}
script: |
cd ~
./deploy.sh
11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
.idea/
.DS_Store
.gradle/
module-api/build/libs/

module-common/build/libs/

module-domain/build/libs/

build/
module-api/build/
module-common/build/
module-domain/build/
module-auth/build/
module-api/src/main/resources/application.yml
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM amd64/amazoncorretto:17
WORKDIR /app
COPY ./module-api/build/libs/module-api-1.0.0-SNAPSHOT.jar /app/MILE.jar
CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=dev", "MILE.jar"]
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ subprojects {
apply plugin: "io.spring.dependency-management"
apply plugin: "java"

version = "1.0.7-SNAPSHOT"
version = "1.0.0-SNAPSHOT"
sourceCompatibility = "17"

repositories {
Expand Down
Binary file removed build/libs/server-plain.jar
Binary file not shown.
Empty file removed build/resolvedMainClassName
Empty file.
2 changes: 0 additions & 2 deletions build/tmp/jar/MANIFEST.MF

This file was deleted.

2 changes: 2 additions & 0 deletions module-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ dependencies {
implementation project(':module-common')
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
}
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
2 changes: 0 additions & 2 deletions module-auth/build/tmp/jar/MANIFEST.MF

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
2 changes: 0 additions & 2 deletions module-common/build/tmp/jar/MANIFEST.MF

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions module-domain/build/tmp/jar/MANIFEST.MF

This file was deleted.

2 changes: 1 addition & 1 deletion module-domain/src/main/java/com/mile/moim/domain/Moim.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Moim {
@ManyToOne
private User owner;
private String name;
private String image;
private String imageUrl;
private String information;
private boolean isPublic;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class PenName {
private Moim moim;

private String penName;
private String image;
private String imageUrl;

@ManyToOne
private User writer;
Expand Down
2 changes: 1 addition & 1 deletion module-domain/src/main/java/com/mile/post/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Post {
private Topic topic;
private String title;
private String content;
private String image;
private String imageUrl;
private int curiousCount;
private boolean anonymous;
private boolean isTemporary;
Expand Down
2 changes: 1 addition & 1 deletion module-domain/src/main/java/com/mile/user/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public class User {
private Long kakaoId;
private String email;
private String name;
private String image;
private String imageUrl;
private String information;
}