Skip to content

Commit dd9b435

Browse files
andie787github-actions[bot]
authored andcommitted
Update docs content from https://github.com/depot/app
1 parent 21fc552 commit dd9b435

File tree

12 files changed

+686
-27
lines changed

12 files changed

+686
-27
lines changed

content/cache/reference/bazel.mdx

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,44 @@ If you are a member of multiple organizations, and you are authenticating with a
3333
build --remote_header=x-depot-org=DEPOT_ORG_ID
3434
```
3535

36-
## Using Depot Cache with Bazel
37-
3836
Once Bazel is configured to use Depot Cache, you can then run your builds as you normally would. Bazel will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
37+
38+
### Using Depot Cache with Bazel in `depot/build-push-action`
39+
40+
When using `depot/build-push-action` to build Docker images that contain Bazel workspaces, your build needs access to Bazel's remote cache credentials to benefit from caching.
41+
42+
These credentials are not automatically available inside your Docker build environment. Unlike builds running directly on Depot-managed GitHub Actions runners (which have automatic access to Depot Cache environment variables), containerized builds execute in isolated VMs that require explicit configuration.
43+
44+
Follow these steps to securely pass your Bazel credentials into your Docker build:
45+
46+
1. Store the Depot token in a GitHub Secret named `DEPOT_TOKEN`.
47+
48+
2. Configure your GitHub Action to pass secrets to the container build:
49+
50+
```yaml
51+
- name: Build and push
52+
uses: depot/build-push-action@v1
53+
with:
54+
context: .
55+
file: ./Dockerfile
56+
push: true
57+
tags: your-image:tag
58+
secrets: |
59+
"DEPOT_TOKEN=${{ secrets.DEPOT_TOKEN }}"
60+
```
61+
62+
3. Update your Dockerfile to mount the secrets and configure Bazel:
63+
64+
```dockerfile
65+
# syntax=docker/dockerfile:1
66+
67+
# ... other Dockerfile instructions
68+
69+
# Create .bazelrc with cache configuration
70+
RUN --mount=type=secret,id=DEPOT_TOKEN,env=DEPOT_TOKEN \
71+
echo "build --remote_cache=https://cache.depot.dev" >> ~/.bazelrc && \
72+
echo "build --remote_header=authorization=${DEPOT_TOKEN}" >> ~/.bazelrc && \
73+
bazel build
74+
```
75+
76+
Adding `# syntax=docker/dockerfile:1` as the first line of your Dockerfile enables mounting secrets as environment variables.

content/cache/reference/gocache.mdx

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,47 @@ To set verbose output, add the --verbose option:
4242
export GOCACHEPROG='depot gocache --verbose'
4343
```
4444

45-
## Using Depot Cache with Go
46-
4745
Once Go is configured to use Depot Cache, you can then run your builds as you normally would. Go will automatically communicate with `GOCACHEPROG` to fetch from Depot Cache and reuse any stored build artifacts from your previous builds.
46+
47+
### Using Depot Cache with Go in `depot/build-push-action`
48+
49+
When using `depot/build-push-action` to build Docker images that contain Go projects, your build needs access to Go's remote cache credentials to benefit from caching.
50+
51+
These credentials are not automatically available inside your Docker build environment. Unlike builds running directly on Depot-managed GitHub Actions runners (which have automatic access to Depot Cache environment variables), containerized builds execute in isolated VMs that require explicit configuration.
52+
53+
Follow these steps to securely pass your Go cache credentials into your Docker build:
54+
55+
1. Store the Depot token in a GitHub Secret named `DEPOT_TOKEN`.
56+
57+
2. Configure your GitHub Action to pass secrets to the container build:
58+
59+
```yaml
60+
- name: Build and push
61+
uses: depot/build-push-action@v1
62+
with:
63+
context: .
64+
file: ./Dockerfile
65+
push: true
66+
tags: your-image:tag
67+
secrets: |
68+
"DEPOT_TOKEN=${{ secrets.DEPOT_TOKEN }}"
69+
```
70+
71+
3. Update your Dockerfile to install the Depot CLI and configure Go cache:
72+
73+
```dockerfile
74+
# syntax=docker/dockerfile:1
75+
76+
# ... other Dockerfile instructions
77+
78+
# Install Depot CLI
79+
RUN curl -L https://depot.dev/install-cli.sh | sh
80+
81+
# Mount secret and set GOCACHEPROG
82+
RUN --mount=type=secret,id=DEPOT_TOKEN,env=DEPOT_TOKEN \
83+
PATH="/root/.depot/bin:$PATH" \
84+
GOCACHEPROG="depot gocache" \
85+
go build -v ./
86+
```
87+
88+
Adding `# syntax=docker/dockerfile:1` as the first line of your Dockerfile enables mounting secrets as environment variables.

content/cache/reference/gradle.mdx

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,59 @@ buildCache {
5858
}
5959
```
6060

61-
## Using Depot Cache with Gradle
62-
6361
Once Gradle is configured to use Depot Cache, you can then run your builds as you normally would. Gradle will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
62+
63+
### Using Depot Cache with Gradle in `depot/build-push-action`
64+
65+
When using `depot/build-push-action` to build Docker images that contain Gradle projects, your build needs access to Gradle's remote cache credentials to benefit from caching.
66+
67+
These credentials are not automatically available inside your Docker build environment. Unlike builds running directly on Depot-managed GitHub Actions runners (which have automatic access to Depot Cache environment variables), containerized builds execute in isolated VMs that require explicit configuration.
68+
69+
Follow these steps to securely pass your Gradle credentials into your Docker build:
70+
71+
1. Store the Depot token in a GitHub Secret named `DEPOT_TOKEN`.
72+
73+
2. Update your `settings.gradle` to read the Depot token from an environment variable:
74+
75+
```groovy
76+
buildCache {
77+
remote(HttpBuildCache) {
78+
url = 'https://cache.depot.dev'
79+
enabled = true
80+
push = true
81+
credentials {
82+
username = ''
83+
password = System.getenv('DEPOT_TOKEN')
84+
}
85+
}
86+
}
87+
```
88+
89+
3. Configure your GitHub Action to pass secrets to the container build:
90+
91+
```yaml
92+
- name: Build and push
93+
uses: depot/build-push-action@v1
94+
with:
95+
context: .
96+
file: ./Dockerfile
97+
push: true
98+
tags: your-image:tag
99+
secrets: |
100+
"DEPOT_TOKEN=${{ secrets.DEPOT_TOKEN }}"
101+
```
102+
103+
4. Update your Dockerfile to mount the secret and run the build:
104+
105+
```dockerfile
106+
# syntax=docker/dockerfile:1
107+
108+
# ... other Dockerfile instructions
109+
110+
# Copy settings.gradle and run build with mounted secret
111+
COPY settings.gradle .
112+
RUN --mount=type=secret,id=DEPOT_TOKEN,env=DEPOT_TOKEN \
113+
./gradlew build
114+
```
115+
116+
Adding `# syntax=docker/dockerfile:1` as the first line of your Dockerfile enables mounting secrets as environment variables.

content/cache/reference/maven.mdx

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,87 @@ To manually configure Maven to use Depot Cache, you will need to configure remot
7777

7878
**Note: Maven support currently only supports Depot Organization API tokens, not user tokens.**
7979

80-
## Using Depot Cache with Maven
81-
8280
Once Maven is configured to use Depot Cache, you can run your builds as usual. Maven will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
81+
82+
### Using Depot Cache with Maven in `depot/build-push-action`
83+
84+
When using `depot/build-push-action` to build Docker images that contain Maven projects, your build needs access to Maven's remote cache credentials to benefit from caching.
85+
86+
These credentials are not automatically available inside your Docker build environment. Unlike builds running directly on Depot-managed GitHub Actions runners (which have automatic access to Depot Cache environment variables), containerized builds execute in isolated VMs that require explicit configuration.
87+
88+
Follow these steps to securely pass your Maven credentials into your Docker build:
89+
90+
1. Store the Depot token in a GitHub Secret named `DEPOT_TOKEN`.
91+
92+
2. Configure Maven Build Cache extension in `.mvn/maven-build-cache-config.xml`:
93+
94+
```xml
95+
<cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0"
96+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
97+
xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0 https://maven.apache.org/xsd/build-cache-config-1.0.0.xsd">
98+
<configuration>
99+
<enabled>true</enabled>
100+
<hashAlgorithm>SHA-256</hashAlgorithm>
101+
<validateXml>true</validateXml>
102+
<remote enabled="true" saveToRemote="true" id="depot-cache">
103+
<url>https://cache.depot.dev</url>
104+
</remote>
105+
<projectVersioning adjustMetaInf="true" />
106+
</configuration>
107+
</cache>
108+
```
109+
110+
3. Update your `settings.xml` to read the Depot token from an environment variable. Create or update `.m2/settings.xml`:
111+
112+
```xml
113+
<?xml version="1.0" encoding="UTF-8"?>
114+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
115+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
116+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
117+
<servers>
118+
<server>
119+
<id>depot-cache</id>
120+
<configuration>
121+
<httpHeaders>
122+
<property>
123+
<name>Authorization</name>
124+
<value>Bearer ${env.DEPOT_TOKEN}</value>
125+
</property>
126+
</httpHeaders>
127+
</configuration>
128+
</server>
129+
</servers>
130+
</settings>
131+
```
132+
133+
4. Configure your GitHub Action to pass secrets to the container build:
134+
135+
```yaml
136+
- name: Build and push
137+
uses: depot/build-push-action@v1
138+
with:
139+
context: .
140+
file: ./Dockerfile
141+
push: true
142+
tags: your-image:tag
143+
secrets: |
144+
"DEPOT_TOKEN=${{ secrets.DEPOT_TOKEN }}"
145+
```
146+
147+
5. Update your Dockerfile to copy configuration files and run the build with mounted secret:
148+
149+
```dockerfile
150+
# syntax=docker/dockerfile:1
151+
152+
# ... other Dockerfile instructions
153+
154+
# Copy Maven configuration files
155+
COPY .mvn/maven-build-cache-config.xml .mvn/maven-build-cache-config.xml
156+
COPY .m2/settings.xml /root/.m2/settings.xml
157+
158+
# Run build with mounted secret
159+
RUN --mount=type=secret,id=DEPOT_TOKEN,env=DEPOT_TOKEN \
160+
mvn clean install
161+
```
162+
163+
Adding `# syntax=docker/dockerfile:1` as the first line of your Dockerfile enables mounting secrets as environment variables.

content/cache/reference/moonrepo.mdx

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,54 @@ unstable_remote:
3434

3535
See [moonrepo's remote cache documentation](https://moonrepo.dev/docs/guides/remote-cache#cloud-hosted-depot) for more details.
3636

37-
## Using Depot Cache with moonrepo
38-
3937
Once moonrepo is configured to use Depot Cache, you can then run your builds as you normally would. moonrepo will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
38+
39+
### Using Depot Cache with moonrepo in `depot/build-push-action`
40+
41+
When using `depot/build-push-action` to build Docker images that contain moonrepo workspaces, your build needs access to moonrepo's remote cache credentials to benefit from caching.
42+
43+
These credentials are not automatically available inside your Docker build environment. Unlike builds running directly on Depot-managed GitHub Actions runners (which have automatic access to Depot Cache environment variables), containerized builds execute in isolated VMs that require explicit configuration.
44+
45+
Follow these steps to securely pass your moonrepo credentials into your Docker build:
46+
47+
1. Store the Depot token in a GitHub Secret named `DEPOT_TOKEN`.
48+
49+
2. Configure moonrepo to read the Depot token from an environment variable in `.moon/workspace.yml`:
50+
51+
```yaml
52+
unstable_remote:
53+
host: 'grpcs://cache.depot.dev'
54+
auth:
55+
token: 'DEPOT_TOKEN'
56+
```
57+
58+
3. Configure your GitHub Action to pass secrets to the container build:
59+
60+
```yaml
61+
- name: Build and push
62+
uses: depot/build-push-action@v1
63+
with:
64+
context: .
65+
file: ./Dockerfile
66+
push: true
67+
tags: your-image:tag
68+
secrets: |
69+
"DEPOT_TOKEN=${{ secrets.DEPOT_TOKEN }}"
70+
```
71+
72+
4. Update your Dockerfile to copy the workspace configuration and run the build with mounted secret:
73+
74+
```dockerfile
75+
# syntax=docker/dockerfile:1
76+
77+
# ... other Dockerfile instructions
78+
79+
# Copy moonrepo workspace configuration
80+
COPY .moon/workspace.yml .moon/workspace.yml
81+
82+
# Mount secret as environment variable and run build
83+
RUN --mount=type=secret,id=DEPOT_TOKEN,env=DEPOT_TOKEN \
84+
moon run build
85+
```
86+
87+
Adding `# syntax=docker/dockerfile:1` as the first line of your Dockerfile enables mounting secrets as environment variables.

content/cache/reference/pants.mdx

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,55 @@ If you are a member of multiple organizations, and you are authenticating with a
4141
remote_store_headers = { "x-depot-org" = "DEPOT_ORG_ID" }
4242
```
4343

44-
## Using Depot Cache with Pants
45-
4644
Once Pants is configured to use Depot Cache, you can then run your builds as you normally would. Pants will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
45+
46+
### Using Depot Cache with Pants in `depot/build-push-action`
47+
48+
When using `depot/build-push-action` to build Docker images that contain Pants projects, your build needs access to Pants' remote cache credentials to benefit from caching.
49+
50+
These credentials are not automatically available inside your Docker build environment. Unlike builds running directly on Depot-managed GitHub Actions runners (which have automatic access to Depot Cache environment variables), containerized builds execute in isolated VMs that require explicit configuration.
51+
52+
Follow these steps to securely pass your Pants credentials into your Docker build:
53+
54+
1. Store the Depot token in a GitHub Secret named `DEPOT_TOKEN`.
55+
56+
2. Update your `pants.toml` to read the Depot token from an environment variable:
57+
58+
```toml
59+
[GLOBAL]
60+
remote_cache_read = true
61+
remote_cache_write = true
62+
remote_store_address = "grpcs://cache.depot.dev"
63+
64+
[GLOBAL.remote_store_headers]
65+
Authorization = "%(env.DEPOT_TOKEN)s"
66+
```
67+
68+
3. Configure your GitHub Action to pass secrets to the container build:
69+
70+
```yaml
71+
- name: Build and push
72+
uses: depot/build-push-action@v1
73+
with:
74+
context: .
75+
file: ./Dockerfile
76+
push: true
77+
tags: your-image:tag
78+
secrets: |
79+
"DEPOT_TOKEN=${{ secrets.DEPOT_TOKEN }}"
80+
```
81+
82+
4. Update your Dockerfile to mount the secret and run the build:
83+
84+
```dockerfile
85+
# syntax=docker/dockerfile:1
86+
87+
# ... other Dockerfile instructions
88+
89+
# Copy pants.toml and run build with mounted secret
90+
COPY pants.toml .
91+
RUN --mount=type=secret,id=DEPOT_TOKEN,env=DEPOT_TOKEN \
92+
pants package ::
93+
```
94+
95+
Adding `# syntax=docker/dockerfile:1` as the first line of your Dockerfile enables mounting secrets as environment variables.

0 commit comments

Comments
 (0)