Skip to content

Commit 5f4092a

Browse files
committed
provide our own policy
1 parent ea297f3 commit 5f4092a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/dockerc.zig

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const io = std.io;
1313
const skopeo_content = @embedFile("tools/skopeo");
1414
const mksquashfs_content = @embedFile("tools/mksquashfs");
1515
const umoci_content = @embedFile("tools/umoci.amd64");
16+
17+
const policy_content = @embedFile("tools/policy.json");
18+
1619
const runtime_content = @embedFile("runtime");
1720

1821
const runtime_content_len_u64 = data: {
@@ -37,6 +40,9 @@ pub fn main() !void {
3740
const mksquashfs_path = try extract_file(temp_dir_path, "mksquashfs", mksquashfs_content, allocator);
3841
defer allocator.free(mksquashfs_path);
3942

43+
const policy_path = try extract_file(temp_dir_path, "policy.json", policy_content, allocator);
44+
defer allocator.free(policy_path);
45+
4046
const params = comptime clap.parseParamsComptime(
4147
\\-h, --help Display this help and exit.
4248
\\-i, --image <str> Image to pull.
@@ -84,7 +90,7 @@ pub fn main() !void {
8490
const destination_arg = try std.fmt.allocPrint(allocator, "oci:{s}/image:latest", .{temp_dir_path});
8591
defer allocator.free(destination_arg);
8692

87-
var skopeoProcess = std.ChildProcess.init(&[_][]const u8{ skopeo_path, "copy", image, destination_arg }, gpa.allocator());
93+
var skopeoProcess = std.ChildProcess.init(&[_][]const u8{ skopeo_path, "copy", "--policy", policy_path, image, destination_arg }, gpa.allocator());
8894
_ = try skopeoProcess.spawnAndWait();
8995

9096
const umoci_image_layout_path = try std.fmt.allocPrint(allocator, "{s}/image:latest", .{temp_dir_path});

src/tools/policy.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"default": [
3+
{
4+
"type": "insecureAcceptAnything"
5+
}
6+
]
7+
}

0 commit comments

Comments
 (0)