Skip to content

Commit 9504919

Browse files
committed
add private registries access docs
1 parent 0b171bd commit 9504919

File tree

1 file changed

+88
-4
lines changed

1 file changed

+88
-4
lines changed

template/customization/base-image.mdx

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "How to define a base image for your template"
44
icon: "1"
55
---
66

7-
### Creating template
7+
## Creating template
88

99
When creating a template, you can specify options:
1010

@@ -28,7 +28,7 @@ template = Template(
2828

2929
**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.
3030

31-
### Defining base image
31+
## Defining base image
3232
Choose from predefined base images or use custom ones:
3333

3434
<CodeGroup dropdown>
@@ -93,7 +93,7 @@ template.from_dockerfile("FROM ubuntu:22.04\nRUN apt-get update")
9393
You can only call base image methods once per template. Subsequent calls will throw an error.
9494
</Note>
9595

96-
### Parsing existing Dockerfiles
96+
## Parsing existing Dockerfiles
9797

9898
Convert existing Dockerfiles to template format using `fromDockerfile()`:
9999

@@ -134,7 +134,7 @@ template = (
134134

135135
</CodeGroup>
136136

137-
#### Dockerfile instructions support
137+
### Dockerfile instructions support
138138

139139
| Instruction | Supported | Behavior |
140140
| :--- | :----: | :--- |
@@ -151,3 +151,87 @@ template = (
151151
<Warning>
152152
Multi-stage Dockerfiles are not supported.
153153
</Warning>
154+
155+
## Login to private registries
156+
If your base image is hosted in a private registry, you can provide credentials using the following helpers:
157+
- General registry
158+
- GCP Artifact Registry
159+
- AWS ECR
160+
161+
### General Registry
162+
163+
<CodeGroup dropdown>
164+
165+
```typescript
166+
Template().fromRegistry('ubuntu:22.04', {
167+
username: 'user',
168+
password: 'pass',
169+
})
170+
```
171+
172+
```python
173+
Template().from_registry(
174+
image="ubuntu:22.04",
175+
username="user",
176+
password="pass",
177+
)
178+
```
179+
180+
</CodeGroup>
181+
182+
183+
### GCP Artifact Registry
184+
185+
<CodeGroup dropdown>
186+
187+
```typescript
188+
// From file path
189+
Template().fromGCPRegistry('ubuntu:22.04', {
190+
serviceAccountJSON: './service_account.json',
191+
})
192+
193+
// From object
194+
Template().fromGCPRegistry('ubuntu:22.04', {
195+
serviceAccountJSON: { project_id: '123', private_key_id: '456' },
196+
})
197+
```
198+
199+
```python
200+
# From file path
201+
Template().from_gcp_registry(
202+
image="ubuntu:22.04",
203+
service_account_json="./service_account.json",
204+
)
205+
206+
# From object
207+
Template().from_gcp_registry(
208+
image="ubuntu:22.04",
209+
service_account_json={"project_id": "123", "private_key_id": "456"},
210+
)
211+
```
212+
213+
</CodeGroup>
214+
215+
216+
### AWS ECR
217+
218+
<CodeGroup dropdown>
219+
220+
```typescript
221+
Template().fromAWSRegistry('ubuntu:22.04', {
222+
accessKeyId: '123',
223+
secretAccessKey: '456',
224+
region: 'us-west-1',
225+
})
226+
```
227+
228+
```python
229+
Template().from_aws_registry(
230+
image="ubuntu:22.04",
231+
access_key_id="123",
232+
secret_access_key="456",
233+
region="us-west-1",
234+
)
235+
```
236+
237+
</CodeGroup>

0 commit comments

Comments
 (0)