Skip to content
Open
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
4 changes: 2 additions & 2 deletions cli/src/commands/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ function prepare(opts: SandboxBuildOpts): PreparedBuild {
} else {
const copies = layer.tools
.filter((tool) => tool.executablePath)
.map((tool) => `COPY tools/${tool.dir}/${tool.binary} /usr/local/bin/${tool.binary}`)
.map((tool) => `COPY --chmod=0755 tools/${tool.dir}/${tool.binary} /usr/local/bin/${tool.binary}`)
.join("\n");
dockerfileBody = `FROM ${base}\n${copies}\nRUN chmod -R a+rx /usr/local/bin\n${presenceCheck}`;
dockerfileBody = `FROM ${base}\n${copies}\n${presenceCheck}`;
}
const dockerfilePath = join(mkdtempSync(join(tmpdir(), "qm-sandbox-")), "Dockerfile");
writeFileSync(dockerfilePath, dockerfileBody);
Expand Down
2 changes: 1 addition & 1 deletion cli/test/e2e/sandbox-build.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test("sandbox build --dry-run generates the COPY-tools Dockerfile + the fly push
assert.equal(r.code, 0, r.out);
assert.match(r.out, /DRY RUN — nothing built/);
assert.match(r.out, /FROM registry\.invalid\/qm\/qm-sandbox-base@sha256:a{64}/);
assert.match(r.out, /COPY tools\/example-tool\/example-tool \/usr\/local\/bin\/example-tool/);
assert.match(r.out, /COPY --chmod=0755 tools\/example-tool\/example-tool \/usr\/local\/bin\/example-tool/);
assert.match(r.out, /command -v "\$b"/);
assert.match(r.out, /docker buildx build --platform linux\/amd64 --load -t acme-sandbox:local/);
} finally {
Expand Down
3 changes: 2 additions & 1 deletion cli/test/sandbox-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ test("generates a Dockerfile that COPYs each tool executable onto PATH + bakes t
try {
const out = dryRun({ sandboxDir: sb });
assert.match(out, /FROM registry\.invalid\/qm\/qm-sandbox-base@sha256:a{64}/);
assert.match(out, /COPY tools\/example-tool\/example-tool \/usr\/local\/bin\/example-tool/);
assert.match(out, /COPY --chmod=0755 tools\/example-tool\/example-tool \/usr\/local\/bin\/example-tool/);
assert.doesNotMatch(out, /chmod -R/);
assert.match(out, /command -v "\$b"/);
assert.match(out, /'example-tool'/);
assert.match(out, /acme-sandbox:local/);
Expand Down