Skip to content

Commit 3d52c2b

Browse files
committed
Chore: CD 파이프라인 추가
1 parent cb97759 commit 3d52c2b

3 files changed

Lines changed: 44 additions & 11 deletions

File tree

.github/workflows/cd.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Login to DockerHub
17+
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
18+
19+
- name: Extract Docker image metadata
20+
id: meta
21+
uses: docker/metadata-action@v5
22+
with:
23+
images: dungbik/flipnote-user
24+
- name: Build and push Docker image
25+
uses: docker/build-push-action@v6
26+
with:
27+
context: .
28+
push: true
29+
tags: ${{ steps.meta.outputs.tags }}
30+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
# Build stage
2-
FROM gradle:8.11-jdk21 AS build
1+
FROM gradle:8-jdk21 AS build
32
WORKDIR /app
3+
44
COPY build.gradle.kts settings.gradle.kts ./
5-
COPY gradle ./gradle
65
COPY src ./src
6+
77
RUN gradle bootJar --no-daemon
88

9-
# Runtime stage
10-
FROM eclipse-temurin:21-jre-alpine
9+
FROM eclipse-temurin:21-jre
1110
WORKDIR /app
1211

13-
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
14-
USER appuser
12+
ENV TZ=Asia/Seoul
13+
RUN apt-get update \
14+
&& apt-get install -y tzdata \
15+
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
16+
&& echo $TZ > /etc/timezone \
17+
&& rm -rf /var/lib/apt/lists/*
1518

16-
COPY --from=build /app/build/libs/*.jar app.jar
19+
COPY --from=build /app/build/libs/user-0.0.1-SNAPSHOT.jar .
1720

18-
EXPOSE 8081
21+
EXPOSE 8080
1922

20-
ENTRYPOINT ["java", "-jar", "app.jar"]
23+
ENTRYPOINT ["java", "-jar", "user-0.0.1-SNAPSHOT.jar"]

src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ spring:
33
name: user
44

55
datasource:
6-
url: ${DB_URL:jdbc:mysql://localhost:3306/flipnote}
6+
url: ${DB_URL:jdbc:mysql://localhost:3306/flipnote_user}
77
username: ${DB_USERNAME:root}
88
password: ${DB_PASSWORD:root}
99
driver-class-name: com.mysql.cj.jdbc.Driver

0 commit comments

Comments
 (0)