Skip to content

Commit 2e9153a

Browse files
authored
fix: containerize arguments (#58)
* fix: added containerize args, closes #57 * update date * fix: review comment
1 parent 5348051 commit 2e9153a

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 snakemake
3+
Copyright (c) 2019-2026 The Snakemake team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Preliminary commands to run before the workflow execution.
2222

2323
### `task`
2424

25-
Whether to run Snakemake or to generate a container image specification (in the form of a Dockerfile) that contains all required environments. Can be either `run` or `containerize`. Default `run`.
25+
Whether to run Snakemake or to generate a container image specification (`Dockerfile`, `apptainer.def`) that contains all required environments. Can be either `run` or `containerize`. Default `run`.
2626

2727
### `show-disk-usage-on-error`
2828

@@ -36,6 +36,14 @@ Snakemake version to install from conda. Default `*` (latest available version f
3636

3737
Optional Snakemake git branch to install from `https://github.com/snakemake/snakemake`. If set, this takes precedence over `snakemake-version` and Snakemake is installed from source via pip.
3838

39+
### `install-apptainer`
40+
41+
Whether to install Apptainer (true/false). Default `false`.
42+
43+
### `containerize-args`
44+
45+
Additional arguments for `containerize`, can be one of 'dockerfile', 'apptainer' or '' (defaults to dockerfile).
46+
3947
## Example usage
4048

4149
```yaml
@@ -69,4 +77,5 @@ Optional Snakemake git branch to install from `https://github.com/snakemake/snak
6977
directory: ".test"
7078
snakefile: "workflow/Snakefile"
7179
task: "containerize"
80+
containerize-args: "apptainer"
7281
```

action.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ inputs:
4545
description: Install Apptainer (true/false)
4646
required: false
4747
default: "false"
48+
containerize-args:
49+
description: Additional arguments for --containerize, can be one of 'dockerfile', 'apptainer' or '' (defaults to dockerfile)
50+
required: false
51+
default: ""
4852

4953
runs:
5054
using: "composite"
@@ -117,4 +121,10 @@ runs:
117121
- name: Containerize snakemake
118122
if: ${{ inputs.task == 'containerize' }}
119123
shell: bash -el {0}
120-
run: snakemake --directory ${{ inputs.directory }} --snakefile ${{ inputs.snakefile }} --show-failed-logs ${{ inputs.args }} --containerize > Dockerfile
124+
run: |
125+
if [[ "${{ inputs.containerize-args }}" == "apptainer" ]]; then
126+
recipe="apptainer.def"
127+
else
128+
recipe="Dockerfile"
129+
fi
130+
snakemake --directory ${{ inputs.directory }} --snakefile ${{ inputs.snakefile }} --show-failed-logs ${{ inputs.args }} --containerize ${{ inputs.containerize-args }} > $recipe

0 commit comments

Comments
 (0)