Updated Build (markdown)

Christian Mäder 2020-06-02 13:12:26 +02:00
parent cb9a885bfe
commit 18e8e25357

@ -24,29 +24,19 @@ But usually you'd use a selection of them.
## Build the Image from Scratch ## Build the Image from Scratch
The `netbox-docker` image is very advanced and has a rather complex build system. The `netbox-docker` Docker image has a rather complex build system.
That's why all of the complexity was captured in a few files: That's why all of the complexity is captured in a few build scripts:
- **`build.sh`**: This script is called by all the others. Run `./build.sh --help` to see all the options. - `build.sh`:
- **`build-all.sh`**: This script builds all versions of the Netbox Docker Image, i.e. releases (e.g. `v2.6.6`), pre-releases (e.g. `v2.6-beta1`), `latest` and `snapshot`. This is **the main build script**.
- **`build-branches.sh`**: Builds the `master` Git branch as `latest`, the `develop` Git branch as `snapshot` and the `develop-*` branch as `develop-*`. It is called by all the other scripts.
- **`build-latest.sh`**: Queries Github to get the most recent tag. When launched with `PRERELEASE=true` it will build a pre-release tag (usually beta releases) *if* the version of the pre-release is newer than the newest release tag. This produces a version like `v2.6.6` and also tags `v2.6`. Run `./build.sh --help` to see all the options.
- `build-next.sh`:
### Oldschool `docker build` Builds the `master` Git branch as `latest`, the `develop` Git branch as `snapshot` and the `develop-*` branches as `develop-*`.
- `build-latest.sh`:
You can still build the image manually using `docker build`. Queries Github to get the most recent tag.
If you want to do that, you must pass at least one build argument to Docker: When launched with `PRERELEASE=true` it will build a pre-release tag (usually beta releases) *if* the version of the pre-release is newer than the newest release tag.
The `NETBOX_PATH`. This produces a version like `v2.6.6` and also tags `v2.6`.
This build argument must be a path to a folder that contains all the Netbox files.
So, full instructions would look like this:
```bash
git clone https://github.com/netbox-community/netbox-docker.git
cd netbox-docker
git clone https://github.com/netbox-community/netbox.git netbox
docker build --build-arg "NETBOX_PATH=netbox" --target main .
```
### Build Targets ### Build Targets
@ -58,11 +48,6 @@ The Docker file knows multiple build targets:
### Automatic Build ### Automatic Build
There are automatic builds configured on Docker Hub, which are trigger once a day and on every commit to the `master` branch of `netbox-docker`. There are automatic builds configured based on Github Actions, which are trigger once a day and on every commit to the `master` branch of `netbox-docker`.
This automatic build relies on the same `/build*.sh` files as described above. The automatic build relies on the same `/build*.sh` files as described above.
The default commands of Docker Hub are overwritten using the files in `/hooks/*`.
To learn more about the automatic builds read the [`DOCKER_HUB.md`][hub] file.
[hub]: https://github.com/netbox-community/netbox-docker/blob/master/DOCKER_HUB.md