Skip to content

Commit

Permalink
Added glide for vendoring dependencies.
Browse files Browse the repository at this point in the history
 - Docker to 1.13.x
  • Loading branch information
stffabi committed Jan 24, 2017
1 parent 462df02 commit 63aa3ef
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1 +1,3 @@
watchtower
vendor
.glide
22 changes: 5 additions & 17 deletions CONTRIBUTING.md
Expand Up @@ -16,21 +16,9 @@ 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
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)
go get -u github.com/Masterminds/glide # installs glide for vendoring
glide install # 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](https://github.com/CenturyLinkLabs/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/`).

```bash
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)
```

2 changes: 2 additions & 0 deletions circle.yml
Expand Up @@ -5,7 +5,9 @@ machine:
dependencies:
override:
- docker pull centurylink/golang-builder:latest
- go get -u github.com/Masterminds/glide

test:
override:
- glide install
- docker run -v $(pwd):/src centurylink/golang-builder:latest --test
12 changes: 6 additions & 6 deletions container/trust.go
Expand Up @@ -4,13 +4,14 @@ import (
"errors"
"os"
"strings"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/reference"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/cli/config"
"github.com/docker/docker/cli/config/configfile"
"github.com/docker/docker/cli/config/credentials"
"github.com/docker/docker/cliconfig"
"github.com/docker/docker/cliconfig/configfile"
"github.com/docker/docker/cliconfig/credentials"
)

/**
Expand All @@ -35,7 +36,7 @@ func EncodedEnvAuth(ref string) (string, error) {
username := os.Getenv("REPO_USER")
password := os.Getenv("REPO_PASS")
if username != "" && password != "" {
auth := types.AuthConfig {
auth := types.AuthConfig{
Username: username,
Password: password,
}
Expand All @@ -58,7 +59,7 @@ func EncodedConfigAuth(ref string) (string, error) {
if configDir == "" {
configDir = "/"
}
configFile, err := config.Load(configDir)
configFile, err := cliconfig.Load(configDir)
if err != nil {
log.Errorf("Unable to find default config file %s", err)
return "", err
Expand All @@ -80,7 +81,6 @@ func ParseServerAddress(ref string) (string, error) {
}
parts := strings.Split(repository, "/")
return parts[0], nil

}

// CredentialsStore returns a new credentials store based
Expand Down
186 changes: 186 additions & 0 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions glide.yaml
@@ -0,0 +1,28 @@
package: github.com/stffabi/watchtower
import:
- package: github.com/Sirupsen/logrus
version: ~0.11.x
- package: github.com/docker/docker
version: ~1.13.x
subpackages:
- api/types
- api/types/container
- api/types/network
- api/types/reference
- cli/command
- cliconfig
- cliconfig/configfile
- cliconfig/credentials
- client
- package: github.com/stretchr/testify
version: ~1.1.4
subpackages:
- mock
- package: github.com/urfave/cli
version: ~1.19.1
- package: golang.org/x/net
repo: https://github.com/tonistiigi/net.git
subpackages:
- context
- package: github.com/robfig/cron
version: 9585fd555638e77bba25f25db5c44b41f264aeb7

0 comments on commit 63aa3ef

Please sign in to comment.