Skip to content
Merged
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
10 changes: 5 additions & 5 deletions template/customization/base-image.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ When creating a template, you can specify options:
```typescript
const template = Template({
fileContextPath: ".", // Custom file context path
ignoreFilePaths: [".git", "node_modules"], // File patterns to ignore
fileIgnorePatterns: [".git", "node_modules"], // File patterns to ignore
});
```

```python
template = Template(
file_context_path=".", # Custom file context path
ignore_file_paths=[".git", "node_modules"], # File patterns to ignore
file_ignore_patterns=[".git", "node_modules"], # File patterns to ignore
)
```

</CodeGroup>

**File ignoring**: The SDK automatically reads `.dockerignore` files and combines them with your `ignoreFilePaths`. Files matching these patterns are excluded from uploads and hash calculations.
**File ignoring**: The SDK automatically reads `.dockerignore` files and combines them with your `fileIgnorePatterns` (TypeScript) or `file_ignore_patterns` (Python). Files matching these patterns are excluded from uploads and hash calculations.

## Defining base image
Choose from predefined base images or use custom ones:
Expand Down Expand Up @@ -163,14 +163,14 @@ If your base image is hosted in a private registry, you can provide credentials
<CodeGroup dropdown>

```typescript
Template().fromRegistry('ubuntu:22.04', {
Template().fromImage('ubuntu:22.04', {
username: 'user',
password: 'pass',
})
```

```python
Template().from_registry(
Template().from_image(
image="ubuntu:22.04",
username="user",
password="pass",
Expand Down
26 changes: 19 additions & 7 deletions template/customization/defining-template.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ Copy files from your local filesystem to the template:
// Copy a single file
template.copy("package.json", "/app/package.json");

// Copy multiple files
template.copy([
// Copy multiple files to same destination
template.copy(["file1", "file2"], "/app/file")

// Multiple copy operations using copyItems
template.copyItems([
{ src: "src/", dest: "/app/src/" },
{ src: "package.json", dest: "/app/package.json" },
]);
Expand All @@ -85,8 +88,11 @@ template.copy("config.json", "/app/config.json", {
# Copy a single file
template.copy("package.json", "/app/package.json")

# Copy multiple files
template.copy([
# Copy multiple files to the same destination
template.copy(["file1", "file2"], "/app/file")

# Multiple copy operations using copy_items
template.copy_items([
{"src": "src/", "dest": "/app/src/"},
{"src": "package.json", "dest": "/app/package.json"},
])
Expand Down Expand Up @@ -185,24 +191,30 @@ Clone Git repositories during template build (requires `git` to be installed):

```typescript
// Clone a repository
template.gitClone('https://github.com/user/repo.git')

// Clone a repository to a specific path
template.gitClone('https://github.com/user/repo.git', '/app/repo')

// Clone a specific branch
template.gitClone('https://github.com/user/repo.git', '/app/repo', {
branch: 'main',
})

// Clone with depth limit
// Shallow clone with depth limit
template.gitClone('https://github.com/user/repo.git', '/app/repo', {
depth: 1,
})
```

```python
# Basic clone
# Clone a repository
template.git_clone("https://github.com/user/repo.git")

# Clone a repository to a specific path
template.git_clone("https://github.com/user/repo.git", "/app/repo")

# Clone specific branch
# Clone a specific branch
template.git_clone("https://github.com/user/repo.git", "/app/repo", branch="main")

# Shallow clone with depth limit
Expand Down