# Local Builds

## Custom docker builds

If the image is locally built from a checked out git repo, package update can be driven by the availability of git repo changes to pull rather than a new image on a Docker registry. This will both show where a change is available in Home Assistant ( or other MQTT client ), and allow an update to be triggered remotely.

(People sometimes do this as a quick way of forking and changing a repo that doesn’t quite work for them, or if the app is a development work in progress).

Example docker-compose.yaml snippet

```yaml
services:
  mymailserver:
    build: ./build/mymailserver
    environment:
      - UPD2MQTT_GIT_REPO_PATH=build/mymailserver
    volumes:
      - /home/containers/mymailserver/build:/home/containers/mymailserver/build
```

Declare the git path using the env var in `UPD2MQTT_GIT_REPO_PATH` in the docker container ( directly or via an `.env` file), or an equivalent label (see [Docker Labels](https://updates2mqtt.rhizomatics.org.uk/configuration/customizing_containers/#docker-labels)). The git repo at this path will be used as the source of timestamps, and an update command will carry out a `git pull` and `docker-compose build` rather than pulling an image.

Note that the Updates2MQTT docker container needs access to this path declared in its volumes, and that has to be read/write if automated install required.

Since there’s no image digest, the current git revision will be used as the version, like `git:c2b12584a27f`, and when there are remote repo commits to pull, the new version will show how many commits ahead it is, for example `git:c2b12584a27f+5`
