Skip to content

Commit

Permalink
[Feat/#354] pinpoint 적용 (#355)
Browse files Browse the repository at this point in the history
* feat: pinpoint 도커파일 생성

* feat: pinpoint 테스크 생성

* refactor: pinpoint 액션 수정

* fix: profile 구분 방식 변경

* fix: 도커 파일 파라미터 수정

* refactor: 도커파일 profile 분리

* feat: ecs-cd에 적용
  • Loading branch information
belljun3395 authored Aug 21, 2024
1 parent bc6870d commit b93d8b6
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ecs-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
GIT_HASH=$(git rev-parse --short HEAD)
./gradlew buildEcsDockerImage -PimageName=${ECR_REGISTRY}/${ECR_REPOSITORY}:latest
./gradlew buildPinpointEcsDockerImagePrd -PimageName=${ECR_REGISTRY}/${ECR_REPOSITORY}:latest
docker tag ${ECR_REGISTRY}/${ECR_REPOSITORY}:latest ${ECR_REGISTRY}/${ECR_REPOSITORY}:${GIT_HASH}
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY} --all-tags
- name: Get ECR Repository image path
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ecs-dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
GIT_HASH=$(git rev-parse --short HEAD)
./gradlew buildEcsDockerImage -PimageName=${ECR_REGISTRY}/${ECR_REPOSITORY}:latest
./gradlew buildPinpointEcsDockerImageDev -PimageName=${ECR_REGISTRY}/${ECR_REPOSITORY}:latest
docker tag ${ECR_REGISTRY}/${ECR_REPOSITORY}:latest ${ECR_REGISTRY}/${ECR_REPOSITORY}:${GIT_HASH}
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY} --all-tags
- name: Get ECR Repository image path
Expand Down
21 changes: 21 additions & 0 deletions api/Dockerfile.dev.pinpoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM openjdk:18-oracle

RUN mkdir -p /logs

ENV PROFILE default
ENV TZ=Asia/Seoul


EXPOSE 8080

ARG JAVA_OPTS

ARG RELEASE_VERSION
ENV DD_VERSION=${RELEASE_VERSION}

ARG JAR_FILE="build/libs/api.jar"
COPY ${JAR_FILE} app.jar

VOLUME /pinpoint-agent

ENTRYPOINT java -XX:MaxGCPauseMillis=100 -XX:InitialRAMPercentage=50.0 -XX:MaxRAMPercentage=80.0 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 $JAVA_OPTS -jar -javaagent:/pinpoint-agent/pinpoint-bootstrap.jar -Dpinpoint.profiler.profiles.active=release -Dpinpoint.applicationName=fewletter-api-dev app.jar
21 changes: 21 additions & 0 deletions api/Dockerfile.prd.pinpoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM openjdk:18-oracle

RUN mkdir -p /logs

ENV PROFILE default
ENV TZ=Asia/Seoul


EXPOSE 8080

ARG JAVA_OPTS

ARG RELEASE_VERSION
ENV DD_VERSION=${RELEASE_VERSION}

ARG JAR_FILE="build/libs/api.jar"
COPY ${JAR_FILE} app.jar

VOLUME /pinpoint-agent

ENTRYPOINT java -XX:MaxGCPauseMillis=100 -XX:InitialRAMPercentage=50.0 -XX:MaxRAMPercentage=80.0 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 $JAVA_OPTS -jar -javaagent:/pinpoint-agent/pinpoint-bootstrap.jar -Dpinpoint.profiler.profiles.active=release -Dpinpoint.applicationName=fewletter-api-prd app.jar
42 changes: 42 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,46 @@ tasks.register("buildEcsDockerImage") {
)
}
}
}

tasks.register("buildPinpointEcsDockerImageDev") {
dependsOn("bootJar")

doLast {
exec {
workingDir(".")
commandLine(
"docker",
"build",
"-t",
imageName,
"--build-arg",
"RELEASE_VERSION=$releaseVersion",
"-f",
"Dockerfile.dev.pinpoint",
'.'
)
}
}
}

tasks.register("buildPinpointEcsDockerImagePrd") {
dependsOn("bootJar")

doLast {
exec {
workingDir(".")
commandLine(
"docker",
"build",
"-t",
imageName,
"--build-arg",
"RELEASE_VERSION=$releaseVersion",
"-f",
"Dockerfile.prd.pinpoint",
'.'
)
}
}
}

0 comments on commit b93d8b6

Please sign in to comment.