Skip to content

Commit

Permalink
refactor: 도커 이미지 빌드 과정 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 committed Jun 29, 2024
1 parent 3ed8a1f commit 5d4230b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:

- name: Build Docker Image
run: |
./gradlew --info api:buildDockerImage -PreleaseVersion=${{ env.RELEASE_VERSION }}
./gradlew --info api:buildDockerImage -PimageName=fewletter/api -PreleaseVersion=${{ env.RELEASE_VERSION }}
18 changes: 15 additions & 3 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.hidetake.gradle.swagger.generator.GenerateSwaggerUI
import java.util.Random

dependencies {
/** module */
Expand Down Expand Up @@ -79,14 +80,14 @@ val imageName = project.hasProperty("imageName").let {
if (it) {
project.property("imageName") as String
} else {
"api"
"fewletter/api"
}
}
val releaseVersion = project.hasProperty("releaseVersion").let {
if (it) {
project.property("releaseVersion") as String
} else {
"latest"
Random().nextInt(90000) + 10000
}
}

Expand All @@ -106,7 +107,18 @@ tasks.register("buildDockerImage") {

exec {
workingDir(".")
commandLine("docker", "buildx", "build", "--platform=linux/amd64,linux/arm64", "-t", "fewletter/$imageName", "--build-arg", "RELEASE_VERSION=$releaseVersion", ".", "--push")
commandLine(
"docker", "buildx", "build", "--platform=linux/amd64,linux/arm64", "-t",
"$imageName:latest", "--build-arg", "RELEASE_VERSION=$releaseVersion", "."
)
}

exec {
workingDir(".")
commandLine(
"docker", "buildx", "build", "--platform=linux/amd64,linux/arm64", "-t",
"$imageName:$releaseVersion", "--build-arg", "RELEASE_VERSION=$releaseVersion", "."
)
}
}
}

0 comments on commit 5d4230b

Please sign in to comment.