1
0
mirror of https://github.com/containrrr/watchtower.git synced 2024-12-15 09:14:13 +02:00
watchtower/CONTRIBUTING.md

1.8 KiB

Prerequisites

To contribute code changes to this project you will need the following development kits.

Checking out the code

When cloning watchtower to your development environment you should place your forked repo within the standard go code structure.

cd $GOPATH/src
mkdir <yourfork>
cd <yourfork>
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.

go get ./... # analyzes and retrieves package dependencies
go build     # compiles and packages an executable binary, watchtower
go test      # runs tests
./watchtower # runs the application (outside of a container)

Building the docker image

watchtower is packaged and distributed as a docker image. A golang-builder is used to package the go code and its dependencies as a minimally-sized application. The application binary is then layered into to a minimal docker image (see Dockerfile), so that the entire image is <10MB. See circle.yml for further details.The following commands assume that you are at the root level of your repo (i.e. watchtower/).

docker pull centurylink/golang-builder:latest									# download the builder
docker run -v $(pwd):/src centurylink/golang-builder:latest						# build the minimal binary
docker build -t <yourfork>/watchtower:latest .									# build the docker image
docker run -v /var/run/docker.sock:/var/run/docker.sock <yourfork>/watchtower	# run the application (inside of a container)