From b21c7e6a94ccc1961da693cc5b4daf2c61bb6889 Mon Sep 17 00:00:00 2001 From: vsoch Date: Thu, 28 May 2020 15:05:47 -0600 Subject: [PATCH] ensuring that we dont support multistage builds Signed-off-by: vsoch --- CHANGELOG.md | 1 + docs/pages/recipes.md | 7 +++++++ spython/main/parse/parsers/docker.py | 15 +++++++++++++-- spython/version.py | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3baeaf1b..2d073538 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The client here will eventually be released as "spython" (and eventually to singularity on pypi), and the versions here will coincide with these releases. ## [master](https://github.com/singularityhub/singularity-cli/tree/master) + - Singularity does not support multistage builds (0.0.82) - stream command should print to stdout given CalledProcessError (0.0.81) - USER regular expression should check for USER at start of line (0.0.80) - add singularity options parameters to send to singularity (0.0.79) diff --git a/docs/pages/recipes.md b/docs/pages/recipes.md index 86f52c0b..753aa2ee 100644 --- a/docs/pages/recipes.md +++ b/docs/pages/recipes.md @@ -22,6 +22,13 @@ Now we can answer what kind of things might you want to do: - convert a Singularity Recipe to a Dockerfile - read in a recipe of either type, and modify it before doing the above +**Important** Singularity does not support multistage builds defined within +a single file, so if your Dockerfile has lines like: + +``` +COPY --from=builder /build/usr/share/gdal/ /usr/share/gdal/ +``` +You should modify the Dockerfile first to remove them. # Command Line Client diff --git a/spython/main/parse/parsers/docker.py b/spython/main/parse/parsers/docker.py index 0026bee4..b5e4e864 100644 --- a/spython/main/parse/parsers/docker.py +++ b/spython/main/parse/parsers/docker.py @@ -132,8 +132,10 @@ def _arg(self, line): """ line = self._setup("ARG", line) - bot.warning("ARG is not supported for Singularity! To get %s" % line[0]) - bot.warning("in the container, on host export SINGULARITY_%s" % line[0]) + bot.warning( + "ARG is not supported for Singularity! Add as ENV to the container or export" + " SINGULARITYENV_%s on the host." % line[0] + ) # Env Parser @@ -216,6 +218,15 @@ def _copy(self, lines): lines = self._setup("COPY", lines) for line in lines: + + # Singularity does not support multistage builds + if line.startswith("--from"): + bot.warning( + "Singularity does not support multistage builds, skipping COPY %s" + % line + ) + continue + values = line.split(" ") topath = values.pop() for frompath in values: diff --git a/spython/version.py b/spython/version.py index d52fddd7..730fb7d9 100644 --- a/spython/version.py +++ b/spython/version.py @@ -5,7 +5,7 @@ # with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -__version__ = "0.0.81" +__version__ = "0.0.82" AUTHOR = "Vanessa Sochat" AUTHOR_EMAIL = "vsochat@stanford.edu" NAME = "spython"