From e313cd9482816eba97ea5b064329eec75ef23325 Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Wed, 24 Sep 2025 21:02:58 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat=20:=20ci=20=EA=B5=AC=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle.yml | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..bda7ac9 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,79 @@ +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +permissions: + contents: read + packages: write + +env: + REGISTRY: ghcr.io + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: "17" + cache: gradle + + - name: Copy application.yml into runner + run: | + touch ./main/java/src/main/resources/application.yml + cat > src/main/resources/application.yml <<'YAML' ${{ secrets.APPLICATION_YML }} YAML + + - name: Build + Test(Gradle) + if: ${{ hashFiles('**/build.gradle*') != '' }} + run: | + chmod +x ./gradlew + ./gradlew clean test + ./gradlew bootJar + JAR=$(ls build/libs/*.jar | head -n 1) + cp "$JAR" app.jar + + - name: Compute image name (change to lowercase) + id: img + run: echo "name=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Extract Docker metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ steps.img.outputs.name }} + tags: | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=ref,event=tag + type=sha + + - name: Set up Docker Build + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From 5983d5a6c3b870f50523abea8aabed9b70a4da01 Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Wed, 24 Sep 2025 21:06:30 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix=20:=20yml=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=AA=85=EB=A0=B9=EC=96=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index bda7ac9..23ffcfc 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -31,8 +31,8 @@ jobs: - name: Copy application.yml into runner run: | - touch ./main/java/src/main/resources/application.yml - cat > src/main/resources/application.yml <<'YAML' ${{ secrets.APPLICATION_YML }} YAML + mkdir -p src/main/resources + echo "${{ secrets.APPLICATION_YML }}" > src/main/resources/application.yml - name: Build + Test(Gradle) if: ${{ hashFiles('**/build.gradle*') != '' }} From 5535cf7db27bb00bc82ff3a9233518dfd4f3d67f Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Wed, 24 Sep 2025 21:09:37 +0900 Subject: [PATCH 3/6] =?UTF-8?q?fix=20:=20workflow=5Fdispatch=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 23ffcfc..17ef5f4 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -5,7 +5,6 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] - workflow_dispatch: permissions: contents: read From abf89a9656ef0474cf5a566cbb767a19874283cd Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Fri, 10 Oct 2025 21:25:33 +0900 Subject: [PATCH 4/6] =?UTF-8?q?temp=20:=20=EB=94=94=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 17ef5f4..d11b61d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -66,6 +66,13 @@ jobs: - name: Set up Docker Build uses: docker/setup-buildx-action@v3 + - name: Debug paths + run: | + pwd + ls -la + find . -maxdepth 3 -iname 'Dockerfile' -print + + - name: Build and push uses: docker/build-push-action@v6 with: From 160373415cb12c370f35986c06cebecce55e5e61 Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Fri, 10 Oct 2025 21:39:07 +0900 Subject: [PATCH 5/6] =?UTF-8?q?feat=20:=20dockerfile=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle.yml | 2 +- Dockerfile | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index d11b61d..1394070 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -77,7 +77,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - file: ./Dockerfile + file: ./dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5dca8d3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM eclipse-temurin:17-jre-alpine +WORKDIR /app +COPY app.jar app.jar +EXPOSE 8080 +ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file From a06aec3cd65074e2eb1f890ffecac40a11a27df4 Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Fri, 10 Oct 2025 21:43:42 +0900 Subject: [PATCH 6/6] =?UTF-8?q?fix=20:=20dockerfile=20=EA=B2=BD=EB=A1=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1394070..d11b61d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -77,7 +77,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - file: ./dockerfile + file: ./Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}