Skip to content

Commit 9779537

Browse files
authored
feat: CD 파이프라인 구축 (#71)
* chore: .gitignore 추가 * feat: release-workflow, Dockerfile 추가 * fix: main에서 release로 변경
1 parent 6018ddf commit 9779537

File tree

3 files changed

+102
-1
lines changed

3 files changed

+102
-1
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: OromaminC Backend Service Release
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
14+
tagging:
15+
name: 태깅 및 릴리즈
16+
runs-on: ubuntu-latest
17+
outputs:
18+
tag_name: ${{ steps.tag_version.outputs.new_tag }}
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: versioning and tagging
24+
id: tag_version
25+
uses: mathieudutour/[email protected]
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: releasing
30+
uses: ncipollo/release-action@v1
31+
with:
32+
tag: ${{ steps.tag_version.outputs.new_tag }}
33+
name: ${{ steps.tag_version.outputs.new_tag }}
34+
body: ${{ steps.tag_version.outputs.changelog }}
35+
36+
build-image:
37+
name: 도커 이미지 빌드
38+
runs-on: ubuntu-latest
39+
needs: tagging
40+
41+
permissions:
42+
contents: read
43+
packages: write
44+
attestations: write
45+
id-token: write
46+
47+
steps:
48+
- name: Check out Repository
49+
uses: actions/checkout@v4
50+
51+
- name: Setting for Developent
52+
run: echo "${{ secrets.APPLICATION_DEV_YML }}" > src/main/resources/application-dev.yml
53+
54+
- name: Sign in github container registry
55+
uses: docker/login-action@v3
56+
with:
57+
registry: ${{ env.REGISTRY }}
58+
username: ${{ github.actor }}
59+
password: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Extract metadata
62+
id: meta
63+
uses: docker/metadata-action@v5
64+
with:
65+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66+
tags: |
67+
type=sha
68+
type=raw,value=${{ needs.tagging.outputs.tag_name }}
69+
type=raw,value=latest
70+
71+
- name: Build and Push Image
72+
uses: docker/build-push-action@v6
73+
with:
74+
context: .
75+
push: true
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM gradle:jdk21 as builder
2+
3+
WORKDIR /libs
4+
5+
COPY gradlew .
6+
COPY gradle gradle
7+
COPY build.gradle .
8+
COPY settings.gradle .
9+
10+
RUN ./gradlew dependencies --no-daemon || true
11+
12+
COPY src src
13+
14+
RUN ./gradlew build --no-daemon -x test
15+
16+
17+
FROM openjdk:21-slim
18+
19+
WORKDIR /app
20+
21+
COPY --from=builder /libs/build/libs/*.jar app.jar
22+
23+
ENTRYPOINT ["java", "-Dspring.profiles.active=dev", "-jar", "app.jar"]
24+

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = 'com.oronaminc'
8-
version = '0.0.1-SNAPSHOT'
8+
version = '0.1'
99

1010
java {
1111
toolchain {

0 commit comments

Comments
 (0)