Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.gradle
build
out
generated
target
node_modules
client-rest/dist
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ env.secrets
distributions/*/resources/

#**/src/main/resources/settings/*.yaml
# Dockerfile is generated each time we run build.sh
Dockerfile

# compiled output
build/
out/
Expand Down
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Runs the Java/Gradle build and test suite with no local JDK install.
#
# Source is bind-mounted at `docker run` time -- this image is not rebuilt
# per code change. Gradle 6.9.2 (pulled by the wrapper regardless of this
# image's bundled Gradle version) can't parse Java 17 bytecode when
# compiling build.gradle/settings.gradle, so the JDK here is pinned to 11.
#
# The gradle:* image's default GRADLE_USER_HOME is /home/gradle/.gradle --
# mount a named volume there to cache resolved dependencies across runs:
#
# docker build -t datatransferproject/dev .
# docker run --rm -v "$PWD":/workspace -v gradle-cache:/home/gradle/.gradle datatransferproject/dev
FROM gradle:8.10.2-jdk11

WORKDIR /workspace

ENTRYPOINT ["./gradlew"]
CMD ["--no-daemon", "check"]
26 changes: 26 additions & 0 deletions Documentation/Developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,32 @@ limitations under the License.

See [Running Locally](RunningLocally.md) for instructions.

## Running tests in Docker without a local JDK

> **Experimental.** This workflow is new and is intended to gradually become the standard way to build
> and test the project, eventually replacing the requirement for a local JDK. Feedback welcome.

This is unrelated to the demo image built by `dockerize` above -- it's a separate, additive way to run
the Java test suite without installing a JDK locally. The `Dockerfile` at the repo root pins
`gradle:8.10.2-jdk11`; the source is bind-mounted at run time rather than baked into the image, so a
rebuild isn't needed after every code change.

Run the full check task against the current working tree:
```bash
docker compose run --rm test
```

To run a specific Gradle task or test, override the default command:
```bash
docker compose run --rm test test --tests SomeTest
```

The `gradle-cache` named volume (defined in `docker-compose.yml`) persists resolved dependencies across
runs, so only the first run pays the full resolution cost.

The JDK is pinned to 11 because the Gradle wrapper (6.9.2) can't parse Java 17 bytecode when compiling
`build.gradle`/`settings.gradle` -- a `gradle:*-jdk17` image fails outright for this reason.

## Deploying in production

A demo distribution for Google Cloud Platform is available at
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
test:
build: .
volumes:
- .:/workspace
- gradle-cache:/home/gradle/.gradle

volumes:
gradle-cache:
Loading