Skip to content

How to create an adhoc sandbox with a custom Dockerfile? #11

Open
@punkpeye

Description

I have tried:

const sdk = new CodeSandbox(CODESANDBOX_API_KEY);
const sandbox = await sdk.sandbox.create({
  hibernationTimeoutSeconds: 300,
});

await sandbox.fs.writeTextFile(
  '.devcontainer/Dockerfile',
  'FROM python:3.10\nENV FOO=BAR\n',
);

await sandbox.fs.writeTextFile(
  '.devcontainer/devcontainer.json',
  stringifyJson({
    build: {
      dockerfile: './Dockerfile',
    },
    name: 'Test',
  }),
);


const result = await sandbox.shells.run('env | grep FOO');

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions