diff --git a/Dockerfile b/Dockerfile index c3bf67e..c25d6ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,14 @@ # == base ====================== FROM buildpack-deps:bookworm AS base ENV CACHEBUST=2024-09-17 -RUN useradd -m -d /project -u 8000 observable-builder && apt update +RUN useradd -m -u 8000 observable-builder && mkdir /project && \ + chown 8000:8000 /project && apt update ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ RUST_VERSION=1.81.0 \ - VIRTUAL_ENV=/project/.local/python-venv -ENV PATH=/usr/local/cargo/bin:$VIRTUAL_ENV/bin:/project/.local/bin:$PATH + VIRTUAL_ENV=/home/observable-builder/.local/python-venv +ENV PATH=/usr/local/cargo/bin:$VIRTUAL_ENV/bin:/home/observable-builder/.local/bin:$PATH # == node ====================== FROM base AS node @@ -33,10 +34,7 @@ RUN --mount=type=cache,target=/var/cache/apt,id=framework-runtime-python \ python3-dev \ python3-venv \ pipx - -FROM python AS python-poetry USER 8000 -WORKDIR /project RUN pipx install poetry \ && python3 -m venv $VIRTUAL_ENV @@ -126,7 +124,6 @@ FROM base AS runtime COPY --from=general-cli . . COPY --from=node . . COPY --from=python . . -COPY --from=python-poetry . . COPY --from=r . . COPY --from=duckdb . . COPY --from=rust . . diff --git a/package.json b/package.json index ffd2c14..8371127 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,8 @@ "dockerode": "^4.0.2", "glob": "^10.3.12", "semver": "^7.6.0", + "tar-fs": "^3.0.6", "tsx": "^4.7.1", "typescript": "^5.4.3" - }, - "dependencies": { - "tar-fs": "^3.0.6" } } diff --git a/tests/dataloader-languages.test.ts b/tests/dataloader-languages.test.ts index a7de187..80785fa 100644 --- a/tests/dataloader-languages.test.ts +++ b/tests/dataloader-languages.test.ts @@ -83,7 +83,7 @@ describe("Dataloader languages", () => { ], { workingDir: "/project/poetry-test", - mounts: [{ host: "./tests/fixtures/poetry-test", container: "/project/poetry-test" }], + hostContainerDirs: [{ host: "./tests/fixtures/poetry-test", container: "/project/poetry-test" }], }, ); }); diff --git a/tests/index.ts b/tests/index.ts index eef91f7..cbc268d 100644 --- a/tests/index.ts +++ b/tests/index.ts @@ -1,12 +1,9 @@ import { test, before } from "node:test"; -import { resolve } from "node:path"; import assert from "node:assert"; import Dockerode from "dockerode"; import { Stream } from "node:stream"; import semverSatisfies from "semver/functions/satisfies"; -import { basename } from "node:path"; import tar from "tar-fs"; -import { readFileSync } from "node:fs"; export const IMAGE_TAG = "observablehq/framework-runtime:test"; @@ -91,9 +88,9 @@ before(ensureDocker); function copyFilesToContainer( dockerContainer: Dockerode.Container, - files: { host: string; container: string }[], + directories: { host: string; container: string }[], ) { - for (const { host, container } of files) { + for (const { host, container } of directories) { const tarStream = tar.pack(host); dockerContainer.putArchive(tarStream, { path: container }); } @@ -102,10 +99,10 @@ function copyFilesToContainer( export async function runCommandInContainer( command: string[], { - mounts = [], + hostContainerDirs = [], workingDir = "/project", }: { - mounts?: { host: string; container: string}[]; + hostContainerDirs?: { host: string; container: string}[]; workingDir?: string; } = {}, ): Promise<{ stdout: string; stderr: string }> { @@ -116,7 +113,7 @@ export async function runCommandInContainer( Cmd: command, }); - copyFilesToContainer(container, mounts); + copyFilesToContainer(container, hostContainerDirs); const stdout = new StringStream(); const stderr = new StringStream();