Image
Daytona のサンドボックス用イメージ定義を表します。
このクラスを直接インスタンス化しないでください。代わりに Image.base()、Image.debianSlim()、Image.fromDockerfile() などの静的ファクトリメソッドを使用してください。
Accessors
contextList
Get Signature
get contextList(): Context[]Returns
Context[]
イメージに追加されるコンテキストファイルの一覧。
dockerfile
Get Signature
get dockerfile(): stringReturns:
string- Dockerfile の内容。
Methods
base()
static base(image: string): Image既存のベースイメージから Image を作成します。
Parameters:
imagestring - 使用するベースイメージ。
Returns:
Image- Image インスタンス。
Example:
const image = Image.base('python:3.12-slim-bookworm')debianSlim()
static debianSlim(pythonVersion?: "3.9" | "3.10" | "3.11" | "3.12" | "3.13"): Image公式の Python Docker イメージに基づく Debian slim イメージを作成します。
Parameters:
pythonVersion?使用する Python のバージョン。 -"3.9"|"3.10"|"3.11"|"3.12"|"3.13"
Returns:
Image- Image インスタンス。
Example:
const image = Image.debianSlim('3.12')fromDockerfile()
static fromDockerfile(path: string): Image既存の Dockerfile から Image を作成します。
Parameters:
pathstring - Dockerfile へのパス。
Returns:
Image- Image インスタンス。
Example:
const image = Image.fromDockerfile('Dockerfile')addLocalDir()
addLocalDir(localPath: string, remotePath: string): Imageローカルディレクトリをイメージに追加します。
Parameters:
localPathstring - ローカルディレクトリのパス。remotePathstring - イメージ内のディレクトリのパス。
Returns:
Image- Image インスタンス。
Example:
const image = Image .debianSlim('3.12') .addLocalDir('src', '/home/daytona/src')addLocalFile()
addLocalFile(localPath: string, remotePath: string): Imageローカルファイルをイメージに追加します。
Parameters:
localPathstring - ローカルファイルのパス。remotePathstring - イメージ内のファイルのパス。
Returns:
Image- Image インスタンス。
Example:
const image = Image .debianSlim('3.12') .addLocalFile('requirements.txt', '/home/daytona/requirements.txt')cmd()
cmd(cmd: string[]): Imageイメージのデフォルトコマンドを設定します。
Parameters:
cmdstring[] - デフォルトとして設定するコマンド。
Returns:
Image- Image インスタンス。
Example:
const image = Image .debianSlim('3.12') .cmd(['/bin/bash'])dockerfileCommands()
dockerfileCommands(dockerfileCommands: string[], contextDir?: string): Image任意の Dockerfile 形式のコマンドでイメージを拡張します。
Parameters:
dockerfileCommandsstring[] - Dockerfile に追加するコマンド。contextDir?string - コンテキストディレクトリのパス。
Returns:
Image- Image インスタンス。
Example:
const image = Image .debianSlim('3.12') .dockerfileCommands(['RUN echo "Hello, world!"'])entrypoint()
entrypoint(entrypointCommands: string[]): Imageイメージのエントリーポイントを設定します。
Parameters:
entrypointCommandsstring[] - エントリーポイントとして設定するコマンド。
Returns:
Image- Image インスタンス。
Example:
const image = Image .debianSlim('3.12') .entrypoint(['/bin/bash'])env()
env(envVars: Record<string, string>): Imageイメージ内の環境変数を設定します。
パラメーター:
envVarsRecord<string, string> - 設定する環境変数。
戻り値:
Image- Image インスタンス。
例:
const image = Image .debianSlim('3.12') .env({ FOO: 'bar' })pipInstall()
pipInstall(packages: string | string[], options?: PipInstallOptions): Imagepip を使用してパッケージをインストールするコマンドを追加します。
パラメーター:
packagesインストールするパッケージ -string|string[]options?PipInstallOptions - pip インストールコマンドのオプション。
戻り値:
Image- Image インスタンス。
例:
const image = Image.debianSlim('3.12').pipInstall('numpy', { findLinks: ['https://pypi.org/simple'] })pipInstallFromPyproject()
pipInstallFromPyproject(pyprojectToml: string, options?: PyprojectOptions): Imagepyproject.toml ファイルから依存関係をインストールします。
パラメーター:
pyprojectTomlstring - pyproject.toml ファイルのパス。options?PyprojectOptions - pip インストールコマンドのオプション。
戻り値:
Image- Image インスタンス。
例:
const image = Image.debianSlim('3.12')image.pipInstallFromPyproject('pyproject.toml', { optionalDependencies: ['dev'] })pipInstallFromRequirements()
pipInstallFromRequirements(requirementsTxt: string, options?: PipInstallOptions): Imagerequirements.txt ファイルから依存関係をインストールします。
パラメーター:
requirementsTxtstring - requirements.txt ファイルのパス。options?PipInstallOptions - pip インストールコマンドのオプション。
戻り値:
Image- Image インスタンス。
例:
const image = Image.debianSlim('3.12')image.pipInstallFromRequirements('requirements.txt', { findLinks: ['https://pypi.org/simple'] })runCommands()
runCommands(...commands: (string | string[])[]): Imageイメージ内でコマンドを実行します。
パラメーター:
commands…(string | string[])[] - 実行するコマンド。
戻り値:
Image- Image インスタンス。
例:
const image = Image .debianSlim('3.12') .runCommands( 'echo "Hello, world!"', ['bash', '-c', 'echo Hello, world, again!'] )workdir()
workdir(dirPath: string): Imageイメージ内の作業ディレクトリを設定します。
パラメーター:
dirPathstring - 作業ディレクトリのパス。
戻り値:
Image- Image インスタンス。
例:
const image = Image .debianSlim('3.12') .workdir('/home/daytona')コンテキスト
イメージに追加するコンテキストファイルを表します。
プロパティ:
archivePathstring - オブジェクトストレージ内のアーカイブの内部パス。sourcePathstring - ソースファイルまたはディレクトリへのパス。
PipInstallOptions
pip install コマンド用のオプション。
プロパティ:
extraIndexUrls?string[] - pip install コマンドで使用する追加のインデックス URL。extraOptions?string - pip install コマンドで使用する追加オプション。指定した文字列がそのまま pip install コマンドに渡されます。findLinks?string[] - pip install コマンドで使用する find-links。indexUrl?string - pip install コマンドで使用するインデックス URL。pre?boolean - プレリリース版をインストールするかどうか。
により拡張
PyprojectOptions
PyprojectOptions
pyproject.toml からの pip install コマンド用オプション。
プロパティ:
extraIndexUrls?string[] - pip install コマンドで使用する追加のインデックス URL。- 継承元:
PipInstallOptions.extraIndexUrls
- 継承元:
extraOptions?string - pip install コマンドに渡す追加オプション。指定した文字列がそのまま pip install コマンドに渡されます。- 継承元:
PipInstallOptions.extraOptions
- 継承元:
findLinks?string[] - pip install コマンドで使用する find-links。- 継承元:
PipInstallOptions.findLinks
- 継承元:
indexUrl?string - pip install コマンドで使用するインデックス URL。- 継承元:
PipInstallOptions.indexUrl
- 継承元:
optionalDependencies?string[] - 任意でインストールする依存関係。pre?boolean - プレリリース版をインストールするかどうか。- 継承元:
PipInstallOptions.pre
- 継承元:
継承:
PipInstallOptions