Skip to content

Commit 8d0c309

Browse files
pditommasoclaude
andauthored
Add --build-template option for container build templates (#101)
- Add --build-template CLI option to specify build templates - Update wave-api and wave-utils to version 1.31.0 - Update required Wave backend version to 1.31.0 - Support templates: conda/micromamba:v1, conda/micromamba:v2, conda/pixi:v1, cran/installr:v1 - Update documentation and usage examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 25c2d20 commit 8d0c309

8 files changed

Lines changed: 60 additions & 5 deletions

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,29 @@ If you use [Homebrew](https://brew.sh/), you can install like this:
106106
docker run $container sh -c hello.sh
107107
```
108108
109-
#### Build a Conda multi-packages container
109+
#### Build a Conda multi-packages container
110110
111111
```bash
112112
container=$(wave --conda-package bamtools=2.5.2 --conda-package samtools=1.17)
113113
docker run $container sh -c 'bamtools --version && samtools --version'
114114
```
115115
116+
#### Build a Conda container using Pixi (multi-stage build)
117+
118+
Use the `--build-template` option to select an optimized build template. The `conda/pixi:v1` template
119+
uses the [Pixi](https://pixi.sh/) package manager with multi-stage builds for smaller, more secure images:
120+
121+
```bash
122+
container=$(wave --conda-package bamtools=2.5.2 --build-template conda/pixi:v1)
123+
docker run $container bamtools --version
124+
```
125+
126+
Available build templates:
127+
- `conda/micromamba:v1` - Default Conda build using Micromamba 1.x
128+
- `conda/micromamba:v2` - Multi-stage build using Micromamba 2.x
129+
- `conda/pixi:v1` - Multi-stage build using Pixi package manager
130+
- `cran/installr:v1` - Build template for CRAN/R packages
131+
116132
#### Build a container by using a Conda environment file
117133
118134
1. Create the Conda environment file:

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ repositories {
1919
}
2020

2121
dependencies {
22-
implementation 'io.seqera:wave-api:1.28.0'
23-
implementation 'io.seqera:wave-utils:1.28.0'
22+
implementation 'io.seqera:wave-api:1.31.0'
23+
implementation 'io.seqera:wave-utils:1.31.0'
2424
implementation 'info.picocli:picocli:4.6.1'
2525
implementation 'com.squareup.moshi:moshi:1.15.2'
2626
implementation 'com.squareup.moshi:moshi-adapters:1.15.2'

app/conf/reflect-config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@
285285
"allDeclaredFields":true,
286286
"methods":[{"name":"<init>","parameterTypes":[] }]
287287
},
288+
{
289+
"name":"io.seqera.wave.config.PixiOpts",
290+
"allDeclaredFields":true,
291+
"methods":[{"name":"<init>","parameterTypes":[] }]
292+
},
288293
{
289294
"name":"io.seqera.wave.config.SpackOpts",
290295
"allDeclaredFields":true,

app/src/main/java/io/seqera/wave/cli/App.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ public class App implements Runnable {
219219
@Option(names = {"--build-compression"}, paramLabel = "<value>", description = "Specify the compression algorithm to be used for the build context, it can be 'gzip', 'zstd' or 'estargz'")
220220
private BuildCompression.Mode buildCompression;
221221

222+
@Option(names = {"--build-template"}, paramLabel = "<value>", description = "Specify the build template to be used for building the container, e.g. 'conda/pixi:v1', 'conda/micromamba:v1', 'conda/micromamba:v2', 'cran/installr:v1'")
223+
private String buildTemplate;
224+
222225
public static void main(String[] args) {
223226
try {
224227
final App app = new App();
@@ -432,6 +435,7 @@ protected SubmitContainerTokenRequest createRequest() {
432435
.withScanMode(scanMode)
433436
.withScanLevels(scanLevels)
434437
.withBuildCompression(compression(buildCompression))
438+
.withBuildTemplate(buildTemplate)
435439
;
436440
}
437441

@@ -735,7 +739,7 @@ void printInfo() {
735739
}
736740

737741
protected String serviceVersion() {
738-
return serviceVersion0(getServiceVersion(), "1.28.0");
742+
return serviceVersion0(getServiceVersion(), "1.31.0");
739743
}
740744

741745
protected String serviceVersion0(String current, String required) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name=wave-cli
2-
version=1.6.1
2+
version=1.7.0
33
commitId=unknown

app/src/main/resources/io/seqera/wave/cli/usage-examples.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Examples:
1515
# Build a container based on Conda lock file served via prefix.dev service
1616
wave --conda-package https://prefix.dev/envs/pditommaso/wave/conda-lock.yml
1717

18+
# Build a container based on Conda packages using Pixi build template
19+
wave --conda-package bamtools=2.5.2 --build-template conda/pixi:v1
20+
1821
# Build a container based on CRAN packages
1922
wave --cran-package dplyr=1.1.0 --cran-package ggplot2
2023

app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,32 @@ class AppTest extends Specification {
335335
req.buildCompression == new BuildCompression().withMode(BuildCompression.Mode.estargz)
336336
}
337337

338+
def 'should set build template' () {
339+
given:
340+
def app = new App()
341+
String[] args = ["--build-template", 'conda/pixi:v1']
342+
343+
when:
344+
new CommandLine(app).parseArgs(args)
345+
and:
346+
def req = app.createRequest()
347+
then:
348+
req.buildTemplate == 'conda/pixi:v1'
349+
}
350+
351+
def 'should set build template micromamba' () {
352+
given:
353+
def app = new App()
354+
String[] args = ["--build-template", 'conda/micromamba:v2']
355+
356+
when:
357+
new CommandLine(app).parseArgs(args)
358+
and:
359+
def req = app.createRequest()
360+
then:
361+
req.buildTemplate == 'conda/micromamba:v2'
362+
}
363+
338364
def 'should not allow dry-run and await' () {
339365
given:
340366
def app = new App()

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ include('app')
2525

2626
// enable for local development
2727
// includeBuild("../libseqera")
28+
// includeBuild("../wave")

0 commit comments

Comments
 (0)