Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion pkg/dockerfile/fast_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func (g *FastGenerator) installApt(lines []string, aptTarFile string) ([]string,
// Install apt packages

if aptTarFile != "" {
lines = append(lines, "RUN --mount=from="+dockercontext.AptBuildContextName+",target="+buildTmpDir+" tar --no-overwrite-dir -xf \""+filepath.Join(buildTmpDir, aptTarFile)+"\" -C /")
lines = append(lines, "RUN --mount=from="+dockercontext.AptBuildContextName+",target="+buildTmpDir+" tar --keep-directory-symlink -xf \""+filepath.Join(buildTmpDir, aptTarFile)+"\" -C /")
}
return lines, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/dockerfile/fast_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func TestAptInstall(t *testing.T) {
dockerfile, err := generator.GenerateDockerfileWithoutSeparateWeights()
require.NoError(t, err)
dockerfileLines := strings.Split(dockerfile, "\n")
require.Equal(t, "RUN --mount=from=apt,target=/buildtmp tar --no-overwrite-dir -xf \"/buildtmp/apt.9a881b9b9f23849475296a8cd768ea1965bc3152df7118e60c145975af6aa58a.tar.zst\" -C /", dockerfileLines[5])
require.Equal(t, "RUN --mount=from=apt,target=/buildtmp tar --keep-directory-symlink -xf \"/buildtmp/apt.9a881b9b9f23849475296a8cd768ea1965bc3152df7118e60c145975af6aa58a.tar.zst\" -C /", dockerfileLines[5])
}

func TestValidateConfigWithBuildRunItems(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build:
python_version: "3.12"
fast: true
system_packages:
- "zsh"
python_requirements: requirements.txt
predict: "predict.py:Predictor"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from cog import BasePredictor

import os


class Predictor(BasePredictor):
def predict(self) -> str:
return "hello " + ",".join(os.listdir("/bin"))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
torch==2.5.0
23 changes: 23 additions & 0 deletions test-integration/test_integration/test_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,26 @@ def test_predict_optional_project(tmpdir_factory):
# stdout should be clean without any log messages so it can be piped to other commands
assert result.returncode == 0
assert result.stdout == "hello No One\n"


def test_predict_zsh_package(docker_image):
project_dir = Path(__file__).parent / "fixtures/zsh-package"
build_process = subprocess.run(
["cog", "build", "-t", docker_image],
cwd=project_dir,
capture_output=True,
)
assert build_process.returncode == 0

result = subprocess.run(
["cog", "predict", "--debug", docker_image],
cwd=project_dir,
check=True,
capture_output=True,
text=True,
timeout=DEFAULT_TIMEOUT,
)
# stdout should be clean without any log messages so it can be piped to other commands
assert result.returncode == 0
assert ",sh," in result.stdout
assert ",zsh," in result.stdout
Loading