> For the complete documentation index, see [llms.txt](https://nginxle.onepub.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nginxle.onepub.dev/cli-commands/build.md).

# build

## Building Nginx-LE

Most users of Nginx-LE will never need to run a build. The build tooling is primarily used by the Nginx-LE development team and if you need to customize the code that underpins the Nginx-LE docker image.

When do you need to use the build command?

| Method                               | Build Required | Usage                                                                                                                                                    |
| ------------------------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Customise nginx or the Nginx-LE code | Yes            | Get your hands dirty and modify the core of Nginx-LE.                                                                                                    |
| Extend the Image                     | Maybe          | Create your own Dockerfile based on Nginx-LE. You can use the standard docker tools to build the image if you aren't modifying any of the Nginx-LE code. |
| Serve static content                 | No             | Mount a volume with your static content into /opt/nginx/wwwroot                                                                                          |
| Configure your own Location(s)       | No             | Add nginx compatible `.location` files under /opt/nginx/include                                                                                          |
| Configure as Proxy                   | No             | Add nginx compatible `.location` and `.upstream` files under /opt/nginx/include                                                                          |
| Docker-compose                       | No             | Add Nginx-LE as a service in a docker-compose.yaml file.                                                                                                 |

For details on creating or modifying the docker file see [Create aDockerfile](https://github.com/bsutton/nginx-le#create-a-dockerfile)

To build the Nginx-LE image run:

```
git clone https://github.com/bsutton/nginx-le.git
nginx-le build --image=<repo/image:version>
```

### Switches

The build command takes a number of switches.

#### image

The required `--image` switch sets the docker image/tag name (repo/image:version) for the image.

e.g. --image=noojee/nginx-le:1.0.0

The switch can be abbreviated to `-i`.

#### update-dcli

The optional flag `--update-dcli` causes the build to pull the latest version of dart/dcli rather than using the docker cache instance.

You only need to add this switch if you have an existing build and you need to update the dcli/dart version.

#### debug

The optional flag `--debug` outputs additional build information.

The flag can be abbreviated to `-d`.

##


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://nginxle.onepub.dev/cli-commands/build.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
