2016-10-14 14:10:46 +02:00
## Prerequisites
To contribute code changes to this project you will need the following development kits.
2019-04-14 18:24:54 +02:00
* [Go ](https://golang.org/doc/install )
* [Docker ](https://docs.docker.com/engine/installation/ )
As watchtower utilizes go modules for vendor locking, you'll need atleast Go 1.11.
You can check your current version of the go language as follows:
```bash
~ $ go version
go version go1.12.1 darwin/amd64
```
2016-10-14 14:10:46 +02:00
## Checking out the code
2019-04-14 18:24:54 +02:00
Do not place your code in the go source path.
2016-10-14 14:10:46 +02:00
```bash
git clone git@github.com:< yourfork > /watchtower.git
cd watchtower
```
## Building and testing
watchtower is a go application and is built with go commands. The following commands assume that you are at the root level of your repo.
```bash
2017-01-24 21:49:25 +02:00
go build # compiles and packages an executable binary, watchtower
2019-04-14 18:24:54 +02:00
go test ./... -v # runs tests with verbose output
2017-01-24 21:49:25 +02:00
./watchtower # runs the application (outside of a container)
2016-10-14 14:10:46 +02:00
```
2020-01-09 01:02:47 +02:00
2019-04-14 21:08:11 +02:00
If you dont have it enabled, you'll either have to prefix each command with `GO111MODULE=on` or run `export GO111MODULE=on` before running the commands. [You can read more about modules here. ](https://github.com/golang/go/wiki/Modules )
2020-01-09 01:02:47 +02:00
To build a Watchtower image of your own, use the self-contained Dockerfiles. As the main Dockerfile, they can be found in `dockerfiles/` :
- `dockerfiles/Dockerfile.dev-self-contained` will build an image based on your current local Watchtower files.
- `dockerfiles/Dockerfile.self-contained` will build an image based on current Watchtower's repository on GitHub.
e.g.:
```bash
sudo docker build . -f dockerfiles/Dockerfile.dev-self-contained -t containrrr/watchtower # to build an image from local files
```