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
4 changes: 3 additions & 1 deletion e2e-tests/images/datastore.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ WORKDIR /workflow-backend

# Install JVM tooling (java, sbt) via mise using the e2e environment. This is the
# only thing baked into the image; all backend sources are bind-mounted at runtime.
# It also caches the mise cache directory to speed up subsequent builds.
COPY .tool-versions ./
RUN mise trust -a && mise install java sbt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a quick comment saying that we are using the mise cache here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A great idea, added in a new commit.

RUN --mount=type=cache,target=/mise/cache,sharing=locked \
mise trust -a && mise install java sbt

EXPOSE 9095

Expand Down
4 changes: 3 additions & 1 deletion e2e-tests/images/workflow-frontend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ WORKDIR /workflow-frontend
# Install the toolchain (java, nodejs, sbt, aws-cli) via mise and enable corepack
# so `yarn` is available. This is the only thing baked into the image; the repo
# and its node_modules are bind-mounted at runtime.
# It also caches the mise cache directory to speed up subsequent builds.
COPY .tool-versions ./
RUN mise trust -a && mise install java nodejs sbt aws-cli \
RUN --mount=type=cache,target=/mise/cache,sharing=locked \
mise trust -a && mise install java nodejs sbt aws-cli \
&& mise exec nodejs -- npm install -g corepack \
&& mise exec nodejs -- corepack enable

Expand Down
20 changes: 20 additions & 0 deletions e2e-tests/setup/stack/containers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,24 @@ function getBackendDir(e2eRoot: string): string {
);
}

// Bind-mount the devcontainer's persistent coursier/ivy cache volumes (see
// .devcontainer/*/devcontainer.json) into sbt containers as their dependency
// caches, so `sbt update`/`run` reuse artifacts already fetched from Maven
// Central across container/image rebuilds instead of re-downloading them.
// Falls back to no extra mounts when run outside that devcontainer.
function sbtCacheBindMounts(): { source: string; target: string; mode: "rw" }[] {
const coursierCacheDir = process.env.DEVENV_COURSIER_CACHE_MOUNT_DIR;
const ivyCacheDir = process.env.DEVENV_IVY_CACHE_MOUNT_DIR;
const mounts: { source: string; target: string; mode: "rw" }[] = [];
if (coursierCacheDir) {
mounts.push({ source: coursierCacheDir, target: "/root/.cache/coursier", mode: "rw" });
}
if (ivyCacheDir) {
mounts.push({ source: ivyCacheDir, target: "/root/.ivy2", mode: "rw" });
}
return mounts;
}

function buildDatastoreImage(
e2eRoot: string,
imageTag: string,
Expand Down Expand Up @@ -300,6 +318,7 @@ export async function startDatastore(
// baking it into the image. Read-write because sbt writes target/ dirs.
.withBindMounts([
{ source: backendDir, target: "/workflow-backend", mode: "rw" },
...sbtCacheBindMounts(),
])
.withLogConsumer(createLogConsumer("datastore", streamLogs))
.withExposedPorts(9095)
Expand Down Expand Up @@ -376,6 +395,7 @@ export async function startWorkflow(
// webpack write target/ and public/build into it.
.withBindMounts([
{ source: repoRoot, target: "/workflow-frontend", mode: "rw" },
...sbtCacheBindMounts(),
])
.withEnvironment({
AWS_ENDPOINT_URL_S3: `http://${S3_ENDPOINT_HOST}:${LOCALSTACK_PORT}`,
Expand Down
Loading