Skip to content

Commit

Permalink
docker: include OS name in build result if != linux (#921)
Browse files Browse the repository at this point in the history
This avoids file conflicts when building the same container also
for MS-Windows or MacOS
  • Loading branch information
adrianschroeter committed Feb 27, 2023
1 parent 479bb4c commit 54a9432
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions build-recipe-docker
Expand Up @@ -266,10 +266,14 @@ recipe_build_docker() {
return
fi

# Check for OS setting
GOOS=`$DOCKER_CMD image inspect "$FIRSTTAG" --format '{{ .Os }}'`

# Save the resulting image to a tarball. Use first tag for generating the file name.
mkdir -p $BUILD_ROOT$TOPDIR/DOCKER
FILENAME="$FIRSTTAG"
FILENAME="${FILENAME//[\/:]/-}"
test -n "$GOOS" -a "$GOOS" != "linux" && FILENAME="${FILENAME}_$GOOS"
FILENAME="$FILENAME.${BUILD_ARCH%%:*}"
test -n "$RELEASE" && FILENAME="$FILENAME-$RELEASE"
echo "Saving image $FIRSTTAG to $FILENAME.tar"
Expand Down
2 changes: 1 addition & 1 deletion call-podman
Expand Up @@ -34,7 +34,7 @@ while test -n "$1" ; do
done

if test -z "$IS_UNSHARED" ; then
echo "Unsharing environment"
echo "Unsharing environment" >&2
# unshare mounts and network
exec unshare -m -n $BUILD_DIR/call-podman --isunshared --root "$BUILD_ROOT" "$@"
cleanup_and_exit 1 "exec unshare returned"
Expand Down

0 comments on commit 54a9432

Please sign in to comment.