deepjavalibrary / deepjavalibrary/djl-serving
Nightly Docker build breaks on lmi.Dockerfile's djl_converter_wheel ARG
- Dominant language
- Java
- Stars
- 253
- Forks
- 96
- Avg merge
- 23h 6m
- Merged PRs (30d)
- 3
Description
## Nightly Docker build breaks on `lmi.Dockerfile`'s `djl_converter_wheel` ARG
`serving/docker/lmi.Dockerfile` has this line:
```dockerfile
ARG djl_converter_wheel="https://publish.djl.ai/djl_converter/djl_converter-${djl_version//-*/}-py3-none-any.whl"
```
`${djl_version//-*/}` is bash syntax meant to strip a `-SNAPSHOT` suffix off the version (e.g. `0.36.0-SNAPSHOT` -> `0.36.0`). But Docker's `ARG` interpolation doesn't support this kind of pattern substitution at all - it only supports a small subset of shell parameter expansion (things like `${var:-default}`).
Tried it directly:
```
$ docker build --build-arg djl_version=0.36.0-SNAPSHOT ...
ERROR: failed to solve: failed to process "...${djl_version//-*/}...":
unsupported modifier (/) in substitution
```
I also tried `${djl_version%%-*}` (a different suffix-stripping syntax) and got the identical error - Docker just doesn't support any pattern-substitution operator here, full stop.
### Why this matters
Looking at `.github/workflows/docker-nightly-publish.yml`, the nightly build path (`mode != "release"`) sets:
```
export BUILD_VERSION_ARG_DJL="${DJL_VERSION}-SNAPSHOT"
```
and passes that straight into the Dockerfile as `--build-arg djl_version=...`. So the nightly build path always hits exactly the broken case above - `lmi.Dockerfile` would fail to build with this "unsupported modifier" error whenever it's built with a `-SNAPSHOT` version.
The release path (no `-SNAPSHOT` suffix) doesn't hit this, since the substitution is a no-op when there's no `-` in the version - which is probably why it's gone unnoticed.
### Suggested fix
The suffix-stripping needs to happen in real bash *before* the value is handed to Docker, not inside the Dockerfile's `ARG` line. For example, in `docker-nightly-publish.yml`, compute the stripped version separately:
```bash
DJL_CONVERTER_VERSION="${DJL_VERSION}" # no -SNAPSHOT suffix, just the plain version
```
and pass that as its own build-arg, or pass it through as-is and have the Dockerfile use a plain `${djl_version}` with no substitution, relying on the caller to always pass an already-clean version.
Happy to open a PR for this if that's useful - wanted to flag it as its own issue since it's unrelated to other work I've got in flight (#3067).
Contributor guide
Research direction
Start with serving/docker/lmi.Dockerfile and .github/workflows/docker-nightly-publish.yml; compare how djl_version and BUILD_VERSION_ARG_DJL are passed on the nightly path. Run the affected Docker build with a -SNAPSHOT version. Done means the nightly lmi.Dockerfile build no longer uses unsupported ARG substitution and succeeds with the intended converter version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, docker, github-actions
- Domain
- build-system, ci-cd, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100