Skip to content

Commit

Permalink
Build server with gradle w/ ant
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCreosote committed Jan 20, 2024
1 parent 2cd82e8 commit 96f4e00
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
FROM kbase/sdkbase2 as build

COPY . /tmp/auth2
RUN cd /tmp \
&& git clone https://github.com/kbase/jars \
&& cd auth2 \
&& ant buildwar
RUN cd /tmp/auth2 && ./gradlew war

FROM kbase/kb_jre:latest

Expand All @@ -15,6 +12,8 @@ ARG BRANCH=develop

COPY --from=build /tmp/auth2/deployment/ /kb/deployment/
COPY --from=build /tmp/auth2/jettybase/ /kb/deployment/jettybase/
COPY --from=build /tmp/auth2/build/libs/auth2.war /kb/deployment/jettybase/webapps/ROOT.war
COPY --from=build /tmp/auth2/templates /kb/deployment/jettybase/templates

# The BUILD_DATE value seem to bust the docker cache when the timestamp changes, move to
# the end
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,24 +235,33 @@ Removes all test mode data from the system.
## Requirements

Java 8 (OpenJDK OK)
Apache Ant (http://ant.apache.org/)
MongoDB 2.6+ (https://www.mongodb.com/)
Jetty 9.3+ (http://www.eclipse.org/jetty/download.html)
(see jetty-config.md for version used for testing)
This repo (git clone https://github.com/kbase/auth2)
The jars repo (git clone https://github.com/kbase/jars)
The two repos above need to be in the same parent folder.

## To start server

start mongodb
if using mongo auth, create a mongo user
cd into the auth2 repo
`ant build`
copy `deploy.cfg.example` to `deploy.cfg` and fill in appropriately
`export KB_DEPLOYMENT_CONFIG=<path to deploy.cfg>`
`cd jettybase`
`./jettybase$ java -jar -Djetty.port=<port> <path to jetty install>/start.jar`
cd into the auth2 repo

```
./gradlew war
mkdir -p jettybase/webapps
cp build/libs/auth2.war jettybase/webapps/ROOT.war
cp templates jettybase/templates
```

copy `deploy.cfg.example` to `deploy.cfg` and fill in appropriately

```
export KB_DEPLOYMENT_CONFIG=<path to deploy.cfg>
cd jettybase
./jettybase$ java -jar -Djetty.port=<port> <path to jetty install>/start.jar
```

Or just use the Docker build, which is probably a lot easier.

## Administer the server

Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ compileJava {
} else {
options.release = 8
}
// TODO NOW build in git commit
}

test {
Expand Down Expand Up @@ -68,7 +67,7 @@ jacocoTestReport {
// TODO NOW run tests from Eclipse w/o specifying classpath manually
// TODO NOW make auth, test, and template jars
// TODO NOW make script
// TODO NOW update Docker to move warfile to correct place
// TODO NOW test server starts in docker container, including templates when gradle done

// Custom java project layout
sourceSets {
Expand Down Expand Up @@ -97,6 +96,8 @@ sourceSets {

war {
webXml = file('war/web.xml')
// For some reason the test directories are included in the war file
// although the files are gone. Not sure why
}

def fromURL = { url, name ->
Expand Down

0 comments on commit 96f4e00

Please sign in to comment.