mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	bake: ulimits support
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
		| @@ -33,6 +33,7 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){ | ||||
| 	testBakeRemoteLocalContextRemoteDockerfile, | ||||
| 	testBakeEmpty, | ||||
| 	testBakeShmSize, | ||||
| 	testBakeUlimits, | ||||
| } | ||||
|  | ||||
| func testBakeLocal(t *testing.T, sb integration.Sandbox) { | ||||
| @@ -553,3 +554,35 @@ target "default" { | ||||
| 	require.NoError(t, err) | ||||
| 	require.Contains(t, string(dt), `size=131072k`) | ||||
| } | ||||
|  | ||||
| func testBakeUlimits(t *testing.T, sb integration.Sandbox) { | ||||
| 	dockerfile := []byte(` | ||||
| FROM busybox AS build | ||||
| RUN ulimit -n > first > /ulimit | ||||
| FROM scratch | ||||
| COPY --from=build /ulimit / | ||||
| 	`) | ||||
| 	bakefile := []byte(` | ||||
| target "default" { | ||||
|   ulimits = ["nofile=1024:1024"] | ||||
| } | ||||
| `) | ||||
| 	dir := tmpdir( | ||||
| 		t, | ||||
| 		fstest.CreateFile("docker-bake.hcl", bakefile, 0600), | ||||
| 		fstest.CreateFile("Dockerfile", dockerfile, 0600), | ||||
| 	) | ||||
|  | ||||
| 	dirDest := t.TempDir() | ||||
|  | ||||
| 	out, err := bakeCmd( | ||||
| 		sb, | ||||
| 		withDir(dir), | ||||
| 		withArgs("--set", "*.output=type=local,dest="+dirDest), | ||||
| 	) | ||||
| 	require.NoError(t, err, out) | ||||
|  | ||||
| 	dt, err := os.ReadFile(filepath.Join(dirDest, "ulimit")) | ||||
| 	require.NoError(t, err) | ||||
| 	require.Contains(t, string(dt), `1024`) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 CrazyMax
					CrazyMax