# 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`.

##
