cdklabs / cdklabs/cdk-docker-image-deployment

Fails to build docker image in Java project

Open
#156 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
88
Forks
15
Avg merge
7m
Merged PRs (30d)
30

Description

When using this construct in a Java project, the docker build fails (via `cdk synth`) because it cannot find a lock file.

The `Dockerfile` in the source directory is not building a Node app so has no javascript dependencies.

Running `docker build .` in the same source directory succeeds.

```
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project deploy: An exception occured while executing the Java class. Cannot find a package lock file (`pnpm-lock.yaml`, `yarn.lock` or `package-lock.json`). Please specify it with `depsLockFilePath`.
Error: Cannot find a package lock file (`pnpm-lock.yaml`, `yarn.lock` or `package-lock.json`). Please specify it with `depsLockFilePath`.
at findLockFile (/private/var/folders/6p/nfwpmyxs7c761mfx9702wz_c0000gt/T/jsii-kernel-1qMcr5/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.js:1:2083)
at new NodejsFunction (/private/var/folders/6p/nfwpmyxs7c761mfx9702wz_c0000gt/T/jsii-kernel-1qMcr5/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.js:1:1072)
at new DockerImageDeployment (/private/var/folders/6p/nfwpmyxs7c761mfx9702wz_c0000gt/T/jsii-kernel-1qMcr5/node_modules/cdk-docker-image-deployment/lib/docker-image-deployment.js:55:32)
at Kernel._create (/private/var/folders/6p/nfwpmyxs7c761mfx9702wz_c0000gt/T/jsii-java-runtime3528284627820127700/lib/program.js:8467:29)
at Kernel.create (/private/var/folders/6p/nfwpmyxs7c761mfx9702wz_c0000gt/T/jsii-java-runtime3528284627820127700/lib/program.js:8196:29)
at KernelHost.processRequest (/private/var/folders/6p/nfwpmyxs7c761mfx9702wz_c0000gt/T/jsii-java-runtime3528284627820127700/lib/program.js:11482:36)
at KernelHost.run (/private/var/folders/6p/nfwpmyxs7c761mfx9702wz_c0000gt/T/jsii-java-runtime3528284627820127700/lib/program.js:11442:22)
at Immediate._onImmediate (/private/var/folders/6p/nfwpmyxs7c761mfx9702wz_c0000gt/T/jsii-java-runtime3528284627820127700/lib/program.js:11443:46)
at process.processImmediate (node:internal/timers:471:21)
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `cdk synth` for the Java project and compare it with `docker build .` in the source directory. Trace the `DockerImageDeployment` and `NodejsFunction` entry points, including `depsLockFilePath` handling. Done means a Dockerfile that does not build a Node app can synthesize without a JavaScript lock file.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, typescript
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.