-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to add file to a specific directory #2453
Comments
I think this covers what you're asking for: #1581 tl;dr - maven:
gradle:
|
Closing as duplicate of #1581, feel free to comment on the existing issue if you have anything to add. |
I believe this will work if the target can be a classpath and I can somehow add "static" as a prefix without copying my files somewhere else first.
Do you have a Gradle + Kotlin example?
Also, it looks like this is an open issue. Any chance there's a timeline for adding it as a feature?
… On May 5, 2020, at 18:55, Tad Cordle ***@***.***> wrote:
Closed #2453.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@TadCordle No need to answer my questions. I figured out a solution with @saturnism's help. Here's my Gradle + Kotlin build for Spring Boot that uses Jib and creates an image with Angular files from a different directory. import com.moowork.gradle.node.npm.NpmTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("se.patrikerdes.use-latest-versions") version "0.2.13"
id("com.github.ben-manes.versions") version "0.28.0"
id("org.springframework.boot") version "2.2.6.RELEASE"
id("io.spring.dependency-management") version "1.0.9.RELEASE"
id("com.github.node-gradle.node") version "2.2.3"
id("com.google.cloud.tools.jib") version "2.2.0"
kotlin("jvm") version "1.3.61"
kotlin("plugin.spring") version "1.3.61"
kotlin("plugin.jpa") version "1.3.61"
}
val spa = "${projectDir}/../notes";
node {
version = "12.16.2"
nodeModulesDir = file(spa)
}
group = "com.okta.developer"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-data-rest")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.okta.spring:okta-spring-boot-starter:1.4.0")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
if (project.hasProperty("prod")) {
runtimeOnly("org.postgresql:postgresql")
} else {
runtimeOnly("com.h2database:h2")
}
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
val buildWeb = tasks.register<NpmTask>("buildNpm") {
dependsOn(tasks.npmInstall)
setNpmCommand("run", "build")
setArgs(listOf("--", "--prod"))
inputs.dir("${spa}/src")
inputs.dir(fileTree("${spa}/node_modules").exclude("${spa}/.cache"))
outputs.dir("${spa}/dist")
}
val profile = if (project.hasProperty("prod")) "prod" else "dev"
tasks.bootRun {
args("--spring.profiles.active=${profile}")
}
tasks.processResources {
rename("application-${profile}.properties", "application.properties")
if (profile == "prod") {
dependsOn(buildWeb)
from("${spa}/dist/notes") {
into("static")
}
}
}
jib {
to {
image = "mraible/bootiful-angular"
}
container {
environment = mapOf("SPRING_PROFILES_ACTIVE" to profile)
}
}
|
I just started working on it recently, so hopefully it will be in the next release :) |
@saturnism @mraible Jib 2.3.0 is released with this very handy feature. Now you can designate target directories with |
Cool - thanks! |
Description of the issue:
Some web apps require static files to be copied into resources'
static
directory. When adding arbitrary files to Jib, it can be more useful to be able to specify target directory.Similar to the way that a JAR is constructed: https:/oktadeveloper/okta-angular-deployment-example/blob/jar/notes-api/build.gradle.kts#L79
Current workaround is to copy the files into
src/main/resources
, but these are generated files and shouldn't go intosrc
. See https:/oktadeveloper/okta-angular-deployment-example/blob/jar/notes-api/build.gradle.kts#L98jib-gradle-plugin
Configuration:See https:/oktadeveloper/okta-angular-deployment-example/blob/jar/notes-api/build.gradle.kts#L98
Additional Information:
cc @mraible
The text was updated successfully, but these errors were encountered: