Skip to content

Commit

Permalink
updates for new ways to build with Depot
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegalbraith committed Sep 5, 2023
1 parent 9584f2f commit 8782fd0
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 24 deletions.
18 changes: 5 additions & 13 deletions content/guides/devcontainers.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Dev Containers
ogTitle: How to use Depot with Dev Containers
description: Leverage Depot to build your Dev Containers on demand with our `depot configure-docker` command.
description: Leverage Depot to build your Dev Containers on demand with our configure-docker command.
---

# Dev Containers
Expand All @@ -14,26 +14,18 @@ With Depot, you can build your Dev Containers on demand with instant shared cach

## How to use Depot with Dev Containers

### Create a project
First, you will need to make sure you have [installed the `depot` CLI](/docs/quickstart#installing-the-cli) and [configured a project](/docs/quickstart#creating-a-project).

This project represents the Dev Container you want to build and share across your team. You can create a project in Depot by following these steps:

1. Go to your [organizations inside of Depot](/orgs)
2. Click on the `Create Project` button
3. Enter a project name
4. Choose your connection type, `Depot Hosted` or [`Self-Hosted`](/docs/self-hosted/overview)
5. Click `Create Project`

### Install and configure the `depot` CLI

You must install the [`depot` CLI](/docs/cli/installation) to configure your repository and Docker environment to leverage Depot builders.
### Connect to your Depot project from the `depot` CLI

Once the CLI is installed, you can configure your environment:

1. Run `depot login` to login to your Depot account
2. Change into the root of your project directory
3. Run `depot init` to link your project to your repository; this will create a `depot.json` directory in the current directory

**Note: You can also connect `depot` to your project by passing the `DEPOT_PROJECT_ID` environment variable**

### Configure Docker to use Depot

Dev Containers uses the `docker buildx build` command internally to build the container image. You can configure Depot as a plugin for the Docker CLI and Buildx with the following command:
Expand Down
59 changes: 48 additions & 11 deletions content/guides/docker-build.mdx
Original file line number Diff line number Diff line change
@@ -1,27 +1,64 @@
---
title: Docker build
ogTitle: How to use Depot with your existing Docker build command
description: Use Depot with your existing docker build command with our depot configure-docker command.
title: Docker
ogTitle: How to use Depot with your existing Docker commands
description: Use Depot with your existing Docker commands like docker build, docker buildx build, and docker compose build, with our depot configure-docker command.
---

# Docker build
# Docker

## How to use Depot with `docker build`
## Running builds with Depot

To run builds with Depot via `docker`, you still need to connect the build to an active Depot project via the `depot init` and `depot.json` files or via the `DEPOT_PROJECT_ID` environment variable.

## How to use Depot with Docker

Depot can directly integrate with your existing `docker build` workflows via a one-time configuration command from our `depot` CLI. See [our instructions for installing our CLI](/docs/cli/installation) if you still need to do so.
Depot can directly integrate with your existing Docker workflows via a one-time configuration command from our `depot` CLI. See [our instructions for installing our CLI](/docs/cli/installation) if you still need to do so.

With the CLI installed, you can run `configure-docker` to configure your Docker CLI to use Depot as the default handler for `docker build` and `docker buildx build`:

```bash
```shell
depot configure-docker
```

## Running builds with Depot
Underneath the hood, the `configure-docker` command installs Depot as a Docker CLI plugin and sets the plugin as the default Docker builder (i.e., `docker build`). In addition, the command also installs a Depot `buildx` driver and sets that driver as the default driver for `docker buildx build`.

To run builds with Depot via `docker`, you still need to connect the build to an active Depot project either via the `depot init` and `depot.json` file or via the `DEPOT_PROJECT_ID` environment variable.
### `docker build`

Once your `docker` environment is configured to use Depot, you can run your builds as usual.

```bash
DEPOT_PROJECT_ID=<your-project-id> docker build --platform linux/amd64,linux/arm64 .
```shell
docker build --platform linux/amd64,linux/arm64 .
```

If you have correctly configured your Depot project via `depot init` or `DEPOT_PROJECT_ID`, your build will automatically be sent to Depot for execution. You can confirm this by looking for log lines in the output that are prefixed with `[depot]`.

### `docker buildx build`

Similarly, once your environment is configured to use Depot, you can run your `docker buildx build` commands as usual.

```shell
docker buildx build --platform linux/amd64,linux/arm64 .
```

Again, you can confirm that builds are going to your Depot project by looking for log lines that are prefixed with `[depot]` or by checking out the [builds for your project](/orgs).

### `docker compose build`

Underneath the hood, `docker compose build` uses `docker buildx build` to build your images. As a result, you can use `docker compose build` as usual, and your builds will be sent to Depot.

```shell
docker compose build
```

Because of how Compose communicates with the `buildx` driver, there are a few things to be aware of:

1. Confirming the build went to Depot is best done by going to the [builds for your project](/orgs)
2. A new build will be created for each service + architecture defined in your `compose.yml` file. For example, if you have a `web` service and a `worker` service and are building for `linux/amd64` and `linux/arm64`, you will have four builds created in Depot.

### `docker compose up`

The `docker compose up` command will automatically build your images if not already built. As a result, you can use `docker compose up` as usual, and your builds will be sent to Depot.

```shell
docker compose up
```
39 changes: 39 additions & 0 deletions content/overview/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ ogTitle: Getting started with Depot
description: Get started with Depot either locally or in your existing CI provider.
---

import {DocsTOC} from '~/components/DocsTOC'

# Quickstart

<DocsTOC
headings={[
{name: 'Installing the CLI', id: 'installing-the-cli'},
{name: 'Creating an organization', id: 'creating-an-organization'},
{name: 'Creating a project', id: 'creating-a-project'},
{name: 'Running a local build', id: 'running-a-local-build'},
{name: 'Running a build in CI', id: 'running-a-build-in-ci'},
{name: 'Adding a build minute usage cap', id: 'adding-a-build-minute-usage-cap'},
]}
/>

## Installing the CLI

For Mac, you can install the CLI with Homebrew:
Expand All @@ -26,6 +39,21 @@ curl -L https://depot.dev/install-cli.sh | sh -s 0.25.0

For all other platforms, you can download the binary directly from [the latest release](https://github.com/depot/cli/releases).

## Creating an organizations

Organizations are the top level entity in Depot. They typically represent a single company or team. Billing details are attached to an organization.

1. Login to your Depot account to get to your [list of organizations](/orgs)
2. Click on the `Create Organization` button
3. Enter an organization name
4. Click `Create Organization`
5. Select the `Pay-as-you-Go` plan and click `Configure Billing`

**Note: You will be redirected to our Stripe checkout portal where you can enter your billing information.**

6. Enter your billing information and click `Subscribe`
7. You will be redirected back to Depot and your organization will be created

## Creating a project

Projects typically represent a single `Dockerfile` or repository.
Expand Down Expand Up @@ -78,3 +106,14 @@ Integrating Depot into your CI workflow is a very similar process. Depot works w
- [Google Cloud Build](../integrations/google-cloud-build)
- [Jenkins](../integrations/jenkins)
- [Travis CI](../integrations/travis-ci)

## Adding a build minute usage cap

By default, an organization is allowed to use unlimited build minutes in a month. However, you can configure a usage cap on your organization to avoid runaway costs.

1. Go to your [organizations inside of Depot](/orgs) and select your organization
2. Click on the `Settings` button
3. Under the `Usage caps` section you can choose between two options:

- **Unlimited**: By default organizations are configured to use unlimited build minutes in a month
- **Limit build minutes**: You can enter a fixed number of build minutes that your organization is allowed to use in a month. Once the limit is reached, builds will fail to start until the limit is raised or reset.

0 comments on commit 8782fd0

Please sign in to comment.