From a43326917cb7acaf1880cce63e8362f26eaf2616 Mon Sep 17 00:00:00 2001 From: Mingyu Song <100754581+mikekks@users.noreply.github.com> Date: Mon, 23 Sep 2024 22:54:38 +0900 Subject: [PATCH 1/6] =?UTF-8?q?refactor:=20pinpoint=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=20(#370)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(DockerFile): pinpoint 관련 argument 추가 * chore(DockerFile): pinpoint 관련 argument 수정 --- main/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/Dockerfile b/main/Dockerfile index 85f2cc14..3b0e10db 100644 --- a/main/Dockerfile +++ b/main/Dockerfile @@ -3,8 +3,10 @@ WORKDIR /app COPY . /app RUN ./gradlew build -x test +ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.1.jar -Dpinpoint.agentId=agent-in-docker -Dpinpoint.applicationName=spring -Dpinpoint.profiler.profiles.active=release" + FROM openjdk:17-jdk-slim WORKDIR /app COPY --from=build /app/build/libs/*.jar app.jar -ENTRYPOINT ["java","-jar","/app/app.jar"] \ No newline at end of file +ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"] \ No newline at end of file From 9c3174b00f613410632960f2d12310e03f234d71 Mon Sep 17 00:00:00 2001 From: Mingyu Song <100754581+mikekks@users.noreply.github.com> Date: Tue, 24 Sep 2024 01:38:16 +0900 Subject: [PATCH 2/6] =?UTF-8?q?chore(ci/cd):=20docker=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(#404)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-dev.yml | 2 +- .github/workflows/cd-prod.yml | 2 +- main/Dockerfile | 22 +++++++++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd-dev.yml b/.github/workflows/cd-dev.yml index 5bebb21a..9d6f1efa 100644 --- a/.github/workflows/cd-dev.yml +++ b/.github/workflows/cd-dev.yml @@ -38,7 +38,7 @@ jobs: - name: docker image 빌드 및 푸시 (nestjs) run: | - docker build --platform linux/amd64 -t makerscrew/server:develop . + docker build --platform linux/amd64 -t makerscrew/server:develop --build-arg SPRING_PROFILES_ACTIVE=dev . docker push makerscrew/server:develop working-directory: ${{ env.working-directory-nestjs }} diff --git a/.github/workflows/cd-prod.yml b/.github/workflows/cd-prod.yml index ff410206..488df6fb 100644 --- a/.github/workflows/cd-prod.yml +++ b/.github/workflows/cd-prod.yml @@ -32,7 +32,7 @@ jobs: - name: docker image 빌드 및 푸시 (Spring) run: | - docker build --platform linux/amd64 -t makerscrew/main:production . + docker build --platform linux/amd64 -t makerscrew/main:production --build-arg SPRING_PROFILES_ACTIVE=prod . docker push makerscrew/main:production working-directory: ${{ env.working-directory-spring }} diff --git a/main/Dockerfile b/main/Dockerfile index 3b0e10db..1a01b669 100644 --- a/main/Dockerfile +++ b/main/Dockerfile @@ -3,10 +3,26 @@ WORKDIR /app COPY . /app RUN ./gradlew build -x test -ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.1.jar -Dpinpoint.agentId=agent-in-docker -Dpinpoint.applicationName=spring -Dpinpoint.profiler.profiles.active=release" - FROM openjdk:17-jdk-slim WORKDIR /app COPY --from=build /app/build/libs/*.jar app.jar -ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"] \ No newline at end of file +ARG SPRING_PROFILES_ACTIVE + +# Default values +ENV AGENT_ID="agent-in-docker" +ENV APPLICATION_NAME="spring" + +# Set environment variables based on the active profile +RUN if [ "$SPRING_PROFILES_ACTIVE" = "dev" ]; then \ + AGENT_ID="dev-agent"; \ + APPLICATION_NAME="spring-dev"; \ + elif [ "$SPRING_PROFILES_ACTIVE" = "prod" ]; then \ + AGENT_ID="prod-agent"; \ + APPLICATION_NAME="spring-prod"; \ + fi && \ + echo "Using AGENT_ID=$AGENT_ID and APPLICATION_NAME=$APPLICATION_NAME" + +ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.3.jar -Dpinpoint.agentId=$AGENT_ID -Dpinpoint.applicationName=$APPLICATION_NAME -Dpinpoint.profiler.profiles.active=release" + +ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"] From 4619be3fa0f88c12a3427e5bd8d9b3d9c53f3ea5 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 24 Sep 2024 13:23:02 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Revert=20"chore(ci/cd):=20docker=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=88=98=EC=A0=95=20(#404)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9c3174b00f613410632960f2d12310e03f234d71. --- .github/workflows/cd-dev.yml | 2 +- .github/workflows/cd-prod.yml | 2 +- main/Dockerfile | 22 +++------------------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/.github/workflows/cd-dev.yml b/.github/workflows/cd-dev.yml index 9d6f1efa..5bebb21a 100644 --- a/.github/workflows/cd-dev.yml +++ b/.github/workflows/cd-dev.yml @@ -38,7 +38,7 @@ jobs: - name: docker image 빌드 및 푸시 (nestjs) run: | - docker build --platform linux/amd64 -t makerscrew/server:develop --build-arg SPRING_PROFILES_ACTIVE=dev . + docker build --platform linux/amd64 -t makerscrew/server:develop . docker push makerscrew/server:develop working-directory: ${{ env.working-directory-nestjs }} diff --git a/.github/workflows/cd-prod.yml b/.github/workflows/cd-prod.yml index 488df6fb..ff410206 100644 --- a/.github/workflows/cd-prod.yml +++ b/.github/workflows/cd-prod.yml @@ -32,7 +32,7 @@ jobs: - name: docker image 빌드 및 푸시 (Spring) run: | - docker build --platform linux/amd64 -t makerscrew/main:production --build-arg SPRING_PROFILES_ACTIVE=prod . + docker build --platform linux/amd64 -t makerscrew/main:production . docker push makerscrew/main:production working-directory: ${{ env.working-directory-spring }} diff --git a/main/Dockerfile b/main/Dockerfile index 1a01b669..3b0e10db 100644 --- a/main/Dockerfile +++ b/main/Dockerfile @@ -3,26 +3,10 @@ WORKDIR /app COPY . /app RUN ./gradlew build -x test +ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.1.jar -Dpinpoint.agentId=agent-in-docker -Dpinpoint.applicationName=spring -Dpinpoint.profiler.profiles.active=release" + FROM openjdk:17-jdk-slim WORKDIR /app COPY --from=build /app/build/libs/*.jar app.jar -ARG SPRING_PROFILES_ACTIVE - -# Default values -ENV AGENT_ID="agent-in-docker" -ENV APPLICATION_NAME="spring" - -# Set environment variables based on the active profile -RUN if [ "$SPRING_PROFILES_ACTIVE" = "dev" ]; then \ - AGENT_ID="dev-agent"; \ - APPLICATION_NAME="spring-dev"; \ - elif [ "$SPRING_PROFILES_ACTIVE" = "prod" ]; then \ - AGENT_ID="prod-agent"; \ - APPLICATION_NAME="spring-prod"; \ - fi && \ - echo "Using AGENT_ID=$AGENT_ID and APPLICATION_NAME=$APPLICATION_NAME" - -ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.3.jar -Dpinpoint.agentId=$AGENT_ID -Dpinpoint.applicationName=$APPLICATION_NAME -Dpinpoint.profiler.profiles.active=release" - -ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"] +ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"] \ No newline at end of file From 9ab6ea05e294fabc83a567905b6272c180c6af0e Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 24 Sep 2024 13:23:03 +0900 Subject: [PATCH 4/6] =?UTF-8?q?Revert=20"refactor:=20pinpoint=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=20(#370)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a43326917cb7acaf1880cce63e8362f26eaf2616. --- main/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main/Dockerfile b/main/Dockerfile index 3b0e10db..85f2cc14 100644 --- a/main/Dockerfile +++ b/main/Dockerfile @@ -3,10 +3,8 @@ WORKDIR /app COPY . /app RUN ./gradlew build -x test -ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.1.jar -Dpinpoint.agentId=agent-in-docker -Dpinpoint.applicationName=spring -Dpinpoint.profiler.profiles.active=release" - FROM openjdk:17-jdk-slim WORKDIR /app COPY --from=build /app/build/libs/*.jar app.jar -ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"] \ No newline at end of file +ENTRYPOINT ["java","-jar","/app/app.jar"] \ No newline at end of file From 775fb14d82c95e450e84e442ffa11dd777ecb920 Mon Sep 17 00:00:00 2001 From: Mingyu Song <100754581+mikekks@users.noreply.github.com> Date: Thu, 26 Sep 2024 23:56:49 +0900 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20=EB=AA=A8=EB=8B=88=ED=84=B0?= =?UTF-8?q?=EB=A7=81=20=EA=B4=80=EB=A0=A8=20=EC=82=AC=ED=95=AD=20=EB=A1=A4?= =?UTF-8?q?=EB=B0=B1=20(#406)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "Revert "refactor: pinpoint 적용 (#370)"" This reverts commit 9ab6ea05e294fabc83a567905b6272c180c6af0e. * Revert "Revert "chore(ci/cd): docker 파일 수정 (#404)"" This reverts commit 4619be3fa0f88c12a3427e5bd8d9b3d9c53f3ea5. --- .github/workflows/cd-dev.yml | 2 +- .github/workflows/cd-prod.yml | 2 +- main/Dockerfile | 20 +++++++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd-dev.yml b/.github/workflows/cd-dev.yml index 5bebb21a..9d6f1efa 100644 --- a/.github/workflows/cd-dev.yml +++ b/.github/workflows/cd-dev.yml @@ -38,7 +38,7 @@ jobs: - name: docker image 빌드 및 푸시 (nestjs) run: | - docker build --platform linux/amd64 -t makerscrew/server:develop . + docker build --platform linux/amd64 -t makerscrew/server:develop --build-arg SPRING_PROFILES_ACTIVE=dev . docker push makerscrew/server:develop working-directory: ${{ env.working-directory-nestjs }} diff --git a/.github/workflows/cd-prod.yml b/.github/workflows/cd-prod.yml index ff410206..488df6fb 100644 --- a/.github/workflows/cd-prod.yml +++ b/.github/workflows/cd-prod.yml @@ -32,7 +32,7 @@ jobs: - name: docker image 빌드 및 푸시 (Spring) run: | - docker build --platform linux/amd64 -t makerscrew/main:production . + docker build --platform linux/amd64 -t makerscrew/main:production --build-arg SPRING_PROFILES_ACTIVE=prod . docker push makerscrew/main:production working-directory: ${{ env.working-directory-spring }} diff --git a/main/Dockerfile b/main/Dockerfile index 85f2cc14..1a01b669 100644 --- a/main/Dockerfile +++ b/main/Dockerfile @@ -7,4 +7,22 @@ FROM openjdk:17-jdk-slim WORKDIR /app COPY --from=build /app/build/libs/*.jar app.jar -ENTRYPOINT ["java","-jar","/app/app.jar"] \ No newline at end of file +ARG SPRING_PROFILES_ACTIVE + +# Default values +ENV AGENT_ID="agent-in-docker" +ENV APPLICATION_NAME="spring" + +# Set environment variables based on the active profile +RUN if [ "$SPRING_PROFILES_ACTIVE" = "dev" ]; then \ + AGENT_ID="dev-agent"; \ + APPLICATION_NAME="spring-dev"; \ + elif [ "$SPRING_PROFILES_ACTIVE" = "prod" ]; then \ + AGENT_ID="prod-agent"; \ + APPLICATION_NAME="spring-prod"; \ + fi && \ + echo "Using AGENT_ID=$AGENT_ID and APPLICATION_NAME=$APPLICATION_NAME" + +ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.3.jar -Dpinpoint.agentId=$AGENT_ID -Dpinpoint.applicationName=$APPLICATION_NAME -Dpinpoint.profiler.profiles.active=release" + +ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"] From 30ec1a0ae45dd939beb28d3002838034f7d2c535 Mon Sep 17 00:00:00 2001 From: Mingyu Song <100754581+mikekks@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:14:42 +0900 Subject: [PATCH 6/6] =?UTF-8?q?fix(ci/cd):=20=EB=AA=A8=EB=8B=88=ED=84=B0?= =?UTF-8?q?=EB=A7=81=20=EA=B4=80=EB=A0=A8=20=EC=88=98=EC=A0=95=20(#408)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd-dev.yml b/.github/workflows/cd-dev.yml index 9d6f1efa..dc097c37 100644 --- a/.github/workflows/cd-dev.yml +++ b/.github/workflows/cd-dev.yml @@ -32,13 +32,13 @@ jobs: - name: docker image 빌드 및 푸시 (Spring) run: | - docker build --platform linux/amd64 -t makerscrew/main:develop . + docker build --platform linux/amd64 -t makerscrew/main:develop --build-arg SPRING_PROFILES_ACTIVE=dev . docker push makerscrew/main:develop working-directory: ${{ env.working-directory-spring }} - name: docker image 빌드 및 푸시 (nestjs) run: | - docker build --platform linux/amd64 -t makerscrew/server:develop --build-arg SPRING_PROFILES_ACTIVE=dev . + docker build --platform linux/amd64 -t makerscrew/server:develop . docker push makerscrew/server:develop working-directory: ${{ env.working-directory-nestjs }}