diff --git a/.gitignore b/.gitignore index 3530f26..01c1978 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build .goxc.local.json *.test +.wercker diff --git a/Dockerfile b/Dockerfile index dd9ed20..b8fd5f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM google/golang +FROM google/golang-alpine MAINTAINER Sevki ADD . /go/src/willnorris.com/go/imageproxy diff --git a/wercker.yml b/wercker.yml new file mode 100644 index 0000000..675b7e4 --- /dev/null +++ b/wercker.yml @@ -0,0 +1,53 @@ +build: + box: golang + steps: + - setup-go-workspace: + package-dir: willnorris.com/go/imageproxy + + - golint: + exclude: vendor + + - script: + name: go fmt + code: | + output=$(go fmt willnorris.com/go/imageproxy/...) + if [[ $(echo -n $output | wc -l) -ne 0 ]]; then + echo "command should not print anything to succeed:" + echo $output + exit 1 + fi + + - script: + name: go test + code: go test -v $(go list willnorris.com/go/imageproxy/... | grep -v /vendor/) + + - script: + name: go build + code: | + GOOS=linux CGO_ENABLED=0 go build \ + -a -ldflags '-s' \ + -installsuffix cgo \ + -o imageproxy \ + willnorris.com/go/imageproxy/cmd/imageproxy + + - script: + name: copy binary + code: cp imageproxy "$WERCKER_OUTPUT_DIR" + +deploy-docker: + box: + id: alpine + cmd: /bin/sh + steps: + - script: + name: Install packages + code: | + apk --no-cache add ca-certificates + - internal/docker-push: + disable-sync: true + username: $DOCKER_USERNAME + password: $DOCKER_PASSWORD + repository: $DOCKER_OWNER/$WERCKER_GIT_REPOSITORY + tag: $WERCKER_GIT_COMMIT, latest, $WERCKER_GIT_BRANCH + entrypoint: /pipeline/source/imageproxy +