> For the complete documentation index, see [llms.txt](https://docs.release.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.release.com/reference-documentation/helm/building-docker-images.md).

# Building Docker images

You can build Docker images for your Helm charts and define any number of Docker builds for your application. However, Dockerfiles must be located in the application's source control repository and you cannot specify Docker builds from remote source control repositories.

Here's an example of Docker builds for custom Nginx and backend containers:

```
builds:
- name: nginx
  dockerfile: Dockerfile
  context: nginx
  args:
  - MAX_UPLOAD_SIZE=60
- name: backend
  dockerfile: Dockerfile-backend
  context: app
```

### Build environment variables

Each container built by Release will generate environment variables that can be used in your Helm charts. By default, Release adds environment variables for the Docker registry and path to the image built.

```
- key: RELEASE_REGISTRY_ENDPOINT
  value: 123456789000.dkr.ecr.us-east-1.amazonaws.com
  secret: false
- key: RELEASE_REGISTRY_PATH
  value: 123456789000.dkr.ecr.us-east-1.amazonaws.com/acme-org/acme-app
  secret: false
```

Two environment variables are emitted per build. The Ngnix build in our example above will generate the variables `NGINX_REGISTRY_IMAGE_URL` and `NGINX_REGISTRY_IMAGE_SHA`.

Here's an example of generated build environment variables:

```
- key: NGINX_REGISTRY_IMAGE_URL
  value: 123456789000.dkr.ecr.us-east-1.amazonaws.com/acme-org/acme-app/nginx@sha256:f1e8b983e8f842170caed5ce76fa92171acfc0f8296283c85155771374adec9c
  secret: false
- key: NGINX_REGISTRY_IMAGE_SHA
  value: f1e8b983e8f842170caed5ce76fa92171acfc0f8296283c85155771374adec9c
- key: BACKEND_REGISTRY_IMAGE_URL
  value: 123456789000.dkr.ecr.us-east-1.amazonaws.com/acme-org/acme-app/backend@sha256:4852bafb7f7cf76375d0e090f737926210de462ef35c9f9616f8a2e17ebb0dda
  secret: false
- key: BACKEND_REGISTRY_IMAGE_SHA
  value: 4852bafb7f7cf76375d0e090f737926210de462ef35c9f9616f8a2e17ebb0dda
  secret: false
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.release.com/reference-documentation/helm/building-docker-images.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
