> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tinfoil.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Building your own image

> Build and publish a Docker image for your own source code, then reference it from tinfoil-config.yml.

The [quickstart](https://docs.tinfoil.sh/containers/quickstart.md) deploys a **pre-built Docker image**. If you have another pre-built image, reference it directly in the `image` field of your [`tinfoil-config.yml`](https://docs.tinfoil.sh/containers/configuration).

For your own source code, use the Dockerfile and **Build Image** workflow in
[`tinfoil-containers-hello-world`](https://github.com/tinfoilsh/tinfoil-containers-hello-world)
as a starting point:

* **Public source:** keep the application, image-build workflow, config, and measured-release workflows in one public repository.
* **Private source:** keep the application and image-build workflow in a private repository. Reference the published image from a public [`tinfoil-containers-template`](https://github.com/tinfoilsh/tinfoil-containers-template) repository.

> [!NOTE]
>
> If the **published image** is private (not just the source), Tinfoil needs registry credentials to pull it at deploy time. See [Private images](https://docs.tinfoil.sh/containers/private-images.md). Public images work without any configuration.

## Build and publish

1. Edit your application and Dockerfile.
2. Run **Build Image** (`build-image.yml`) with an image version. It pushes the image to GHCR and prints the digest in the workflow summary.
3. Copy that digest into `tinfoil-config.yml` and commit the config to the default branch.
4. Run **Tinfoil Release** with a new release version. Wait for both the tag-creation and measurement/publication phases to succeed before [creating or updating an instance](https://docs.tinfoil.sh/containers/cli.md#creating-an-instance).

Building an image does not publish a deployable enclave release or update a running instance.

## Image digests in the release workflow

The `image` field must pin the exact image with its SHA256 digest:

```yaml tinfoil-config.yml theme={"dark"}
image: "ghcr.io/your-org/your-image@sha256:<digest>"
```

Replace `<digest>` with the real digest from your build or registry before publishing.
The measured-release workflow uses the committed config; it does not build the image
or fill in a placeholder digest.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.