mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	bake: shm-size support
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
		| @@ -32,6 +32,7 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){ | ||||
| 	testBakeRemoteDockerfileCwd, | ||||
| 	testBakeRemoteLocalContextRemoteDockerfile, | ||||
| 	testBakeEmpty, | ||||
| 	testBakeShmSize, | ||||
| } | ||||
|  | ||||
| func testBakeLocal(t *testing.T, sb integration.Sandbox) { | ||||
| @@ -520,3 +521,35 @@ func testBakeEmpty(t *testing.T, sb integration.Sandbox) { | ||||
| 	require.Error(t, err, out) | ||||
| 	require.Contains(t, out, "couldn't find a bake definition") | ||||
| } | ||||
|  | ||||
| func testBakeShmSize(t *testing.T, sb integration.Sandbox) { | ||||
| 	dockerfile := []byte(` | ||||
| FROM busybox AS build | ||||
| RUN mount | grep /dev/shm > /shmsize | ||||
| FROM scratch | ||||
| COPY --from=build /shmsize / | ||||
| 	`) | ||||
| 	bakefile := []byte(` | ||||
| target "default" { | ||||
|   shm-size = "128m" | ||||
| } | ||||
| `) | ||||
| 	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, "shmsize")) | ||||
| 	require.NoError(t, err) | ||||
| 	require.Contains(t, string(dt), `size=131072k`) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 CrazyMax
					CrazyMax