Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7adca8b
Activate Yarn Versions in image using corepack
Saipriya-1144 Jun 26, 2025
d944830
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Jul 8, 2025
4586477
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Jul 8, 2025
d760000
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Jul 8, 2025
78440fe
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Jul 9, 2025
58d1200
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Jul 10, 2025
28a161a
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Jul 23, 2025
3ac8253
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Jul 23, 2025
ae401c9
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Aug 25, 2025
416dea5
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Sep 3, 2025
f9cebac
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Sep 11, 2025
e4cbad3
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Sep 12, 2025
7926026
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Sep 19, 2025
02c1145
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Oct 14, 2025
6fd9073
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Oct 22, 2025
e016c67
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Oct 23, 2025
3bb928e
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Dec 4, 2025
d06be2e
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Dec 4, 2025
cac5645
Merge branch 'main' of https://github.com/microsoft/Oryx
Saipriya-1144 Dec 9, 2025
4971d53
Disable Java Build tests
Saipriya-1144 Dec 9, 2025
c9a004d
Revert "Disable Java Build tests"
Saipriya-1144 Dec 9, 2025
5023160
Reuse virtual env of prev deployment
Saipriya-1144 Dec 12, 2025
c651e38
Reuse virtual env of prev deployment
Saipriya-1144 Dec 12, 2025
0d6d80a
Minor fix
Saipriya-1144 Dec 17, 2025
33315a4
Revert PythonBashScript update
Saipriya-1144 Dec 17, 2025
105e9de
Use lz4
Saipriya-1144 Dec 17, 2025
0f7fa06
Use zst
Saipriya-1144 Dec 17, 2025
8100fd9
Revert "Use zst"
Saipriya-1144 Dec 17, 2025
f354bc2
Update startup script generator
Saipriya-1144 Dec 31, 2025
38a2343
Improve extraction logic
Saipriya-1144 Jan 1, 2026
691cd2d
Send compression command as app setting
Saipriya-1144 Jan 4, 2026
d71b00a
fix syntax error
Saipriya-1144 Jan 4, 2026
6d6c32b
Delete old output.tar before creating new one
Saipriya-1144 Jan 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions images/build/Dockerfiles/gitHubActions.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ RUN apt-get update \
lzma \
lzma-dev \
zlib1g-dev \
pigz \
&& rm -rf /var/lib/apt/lists/* \
# This is the folder containing 'links' to benv and build script generator
&& mkdir -p /opt/oryx
Expand Down
2 changes: 2 additions & 0 deletions images/runtime/python/template.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
xz-utils \
lz4 \
zstd \
# Install gcc due to error installing viztracer returning gcc not found
gcc \
&& rm -rf /var/lib/apt/lists/*
Expand Down
23 changes: 22 additions & 1 deletion src/BuildScriptGenerator/BaseBashBuildScript.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,31 @@ then
{{ end }}

{{ if CompressDestinationDir }}
echo "Deleting existing content of destination directory '$OLD_DESTINATION_DIR'..."
rm -rf "$OLD_DESTINATION_DIR"/output* 2>/dev/null || true

DESTINATION_DIR="$OLD_DESTINATION_DIR"
echo "Compressing content of directory '$preCompressedDestinationDir'..."
cd "$preCompressedDestinationDir"
tar -zcf "$DESTINATION_DIR/output.tar.gz" .

COMPRESSION_CMD="${ORYX_COMPRESSION_COMMAND:-gzip}"

case "$COMPRESSION_CMD" in
gzip)
tar -zcf "$DESTINATION_DIR/output.tar.gz" .
;;
lz4)
tar -I lz4 -cf "$DESTINATION_DIR/output.tar.lz4" .
;;
zstd*)
tar -I "$COMPRESSION_CMD" -cf "$DESTINATION_DIR/output.tar.zst" .
;;
*)
echo "Unsupported compression command: $COMPRESSION_CMD" 1>&2
exit 1
;;
esac

echo "Copied the compressed output to '$DESTINATION_DIR'"
{{ end }}
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,7 @@ public class BuildScriptGeneratorOptions
public string ImageType { get; set; }

public bool OryxDisablePipUpgrade { get; set; }

public string OryxCompressionCommand { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public void Configure(BuildScriptGeneratorLib.BuildScriptGeneratorOptions option
options.CustomRequirementsTxtPath = this.GetStringValue(SettingsKeys.CustomRequirementsTxtPath);
options.CallerId = this.GetStringValue(SettingsKeys.CallerId);
options.OryxDisablePipUpgrade = this.GetBooleanValue(SettingsKeys.OryxDisablePipUpgrade);
options.OryxCompressionCommand = this.GetStringValue(SettingsKeys.OryxCompressionCommand);

// Dynamic install
options.EnableDynamicInstall = this.GetBooleanValue(SettingsKeys.EnableDynamicInstall);
Expand Down
1 change: 1 addition & 0 deletions src/BuildScriptGeneratorCli/SettingsKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ public static class SettingsKeys
public const string DebianFlavor = "DEBIAN_FLAVOR";
public const string CallerId = "CALLER_ID";
public const string OryxDisablePipUpgrade = "ORYX_DISABLE_PIP_UPGRADE";
public const string OryxCompressionCommand = "ORYX_COMPRESSION_COMMAND";
}
}
33 changes: 32 additions & 1 deletion src/startupscriptgenerator/src/common/compressionHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (
"io"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
)

// Untar the output file to the provided destination directory
Expand Down Expand Up @@ -43,12 +45,41 @@ func ExtractTarball(tarballFile string, destinationDir string) {
}

println(fmt.Sprintf("Extracting '%s' to directory '%s'...", tarballFile, destinationDir))
err = untar(destinationDir, tarballFile)
err = extractTar(destinationDir, tarballFile)
if err != nil {
panic(fmt.Sprintf("An error occurred when trying to extract tarball '%s'.", tarballFile))
}
}

func extractTar(dst string, tarballFile string) error {
// Detect compression format based on file extension
if strings.HasSuffix(tarballFile, ".tar.lz4") {
// Use lz4 command-line tool for decompression
return untarWithCommand(dst, tarballFile, "lz4")
} else if strings.HasSuffix(tarballFile, ".tar.zst") {
// Use zstd command-line tool for decompression
return untarWithCommand(dst, tarballFile, "zstd")
} else if strings.HasSuffix(tarballFile, ".tar.gz") || strings.HasSuffix(tarballFile, ".tgz") {
// Use native Go gzip decompression
return untar(dst, tarballFile)
} else {
return fmt.Errorf("unsupported compression format for file: %s", tarballFile)
}
}

// untarWithCommand uses the tar command with specified compression tool
func untarWithCommand(dst string, tarballFile string, compressionTool string) error {
cmd := exec.Command("tar", "-I", compressionTool, "-xf", tarballFile, "-C", dst)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

err := cmd.Run()
if err != nil {
return fmt.Errorf("failed to extract %s archive: %v", compressionTool, err)
}
return nil
}

// Credit to https://medium.com/@skdomino/taring-untaring-files-in-go-6b07cf56bc07
// Untar takes a destination path and a reader; a tar reader loops over the tarfile
// creating the file structure at 'dst' along the way, and writing any files
Expand Down
16 changes: 13 additions & 3 deletions src/startupscriptgenerator/src/python/scriptgenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,19 @@ func (gen *PythonStartupScriptGenerator) GenerateEntrypointScript() string {

if gen.Manifest.CompressDestinationDir == "true" {
println("Output is compressed. Extracting it...")
tarballFile := filepath.Join(gen.AppPath, "output.tar.gz")
common.ExtractTarball(tarballFile, gen.Manifest.SourceDirectoryInBuildContainer)
println(fmt.Sprintf("App path is set to '%s'", gen.Manifest.SourceDirectoryInBuildContainer))

// Try compression formats in order: lz4, zstd, gzip
compressionFormats := []string{"output.tar.lz4", "output.tar.zst", "output.tar.gz"}

for _, format := range compressionFormats {
tarballPath := filepath.Join(gen.AppPath, format)
if common.PathExists(tarballPath) {
println(fmt.Sprintf("Found %s, extracting...", format))
common.ExtractTarball(tarballPath, gen.Manifest.SourceDirectoryInBuildContainer)
println(fmt.Sprintf("App path is set to '%s'", gen.Manifest.SourceDirectoryInBuildContainer))
break
}
}
}

scriptBuilder.WriteString(fmt.Sprintf("echo 'export APP_PATH=\"%s\"' >> ~/.bashrc\n", gen.getAppPath()))
Expand Down
Loading