1
0
mirror of https://github.com/google/nomulus synced 2026-01-06 21:47:31 +00:00
Files
nomulus/jetty/build.gradle
Lai Jiang d1f678bba7 Set up a unified registry servlet for Jetty (#2338)
This PR creates a unified RegistryServlet that will serve all
non-console traffic. It also creates a jetty subproject that allows one
to run Nomulus on top of a standard Jetty 12 runtime.

`./gradlew :jetty:stage` will create a jetty base folder at
`jetty/build/jetty-base` where one is able spin up a local Nomulus server
by running the following command inside the folder:

```bash
java -jar ${JETTY_HOME}/start.jar
```

`JETTY_HOME` is a folder where the [Jetty runtime](https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/12.0.6/jetty-home-12.0.6.zip) is located.

This PR also adds a Gradle task to create a Nomulus image based on the
official Jetty image:

```bash
./gradlew :jetty:buildNomulusImage
```
2024-02-29 17:37:51 +00:00

53 lines
1.5 KiB
Groovy

// Copyright 2024 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
apply plugin: 'war'
tasks.register('copyJettyBase', Copy) {
from(layout.projectDirectory.dir('src/main')) {
include 'jetty-base/**'
}
into layout.buildDirectory
}
war {
setArchiveBaseName("root")
setDestinationDirectory(layout.buildDirectory.dir('jetty-base/webapps'))
dependsOn(tasks.named('copyJettyBase'))
}
dependencies {
implementation project(':core')
}
tasks.register('copyConsole', Copy) {
from("${rootDir}/console-webapp/dist/console-webapp") {
include "**/*"
}
into layout.buildDirectory.dir('jetty-base/webapps/console')
dependsOn(':console-webapp:buildConsoleWebappProd')
}
tasks.register('stage') {
dependsOn(tasks.named('war'))
dependsOn(tasks.named('copyConsole'))
}
tasks.register('buildNomulusImage', Exec) {
commandLine 'docker', 'build', '-t', 'nomulus', '.'
dependsOn(tasks.named('stage'))
}
project.build.dependsOn(tasks.named('buildNomulusImage'))