0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-25 19:20:39 +00:00

Merge pull request #30 from drone-plugins/feature/unification

Unification: Drone config, Makefile, structure and badges
This commit is contained in:
Thomas Boerger 2016-01-26 10:14:23 +01:00
commit ebc61e15fe
5 changed files with 96 additions and 32 deletions

View File

@ -1 +1 @@
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.I7UNh81HqRV7vD9XrlFPRj5OjqcA0Os9gr4HIvWexZ4pbAwW0jG-rS7j0_maMt-36TDnw8yq_QuYYq9krlgrYxOr8hDtD8HpUjvf4gTtBP8gFWlzk2iax7ZYBdt7WzqWLdnOgPO0UbTYsMqpmlvEkWPmWutThEQYUrgtRqL6Wg8C_7ZM9e4HIL-d8v3fEKThJxK4bosRruCULXXEFqy2l98PtkA7ZIuijDB8sHMpRPPhhNyJCfqH1Mq1qc5Lv7BXTnHMWB4o9vc__Mi6fPxKRPdf0UYXwR1aBbrRjHelWFgIIcELZyS_UE-06va6eUhV1VKYIxnhn9WCPCocvaOa3w._YYkhrS1UVH--LOy.70UCog1CF2x1ENWrW8KbeJ98zVPSDsvWW3jFFIpeIiLSMrie9yywx0MDygLZt8DqVyRe65VyUr2_ZLVVgp2PAA8tSB99CAT124zut-MFYfLrczIQompPPXeEOnnbao3zNGCoUBROZVthwDaYD1QRW8ALyV5AoTwz97rm7DaMG1BkzAUSMLcOIXrDsZ3t7kJfT-VLn3NAOQtau7eozG98AWXOHoUQyEKdFAJU6h4ZW7UvuW5Z2ZXwoOSLDEjby9H88bUyDtHqDGPx1tXuPruggbGFExMSTxzFvCJ3SfBtRk7rTdMTJljPeiKVmUGUeBqBUI3PwGcoaKwb22BH89-trNdrdzC3OuBrdtlaGG0eyq28fVVQ3Revdqv9cms9bgQ9RM1o9A.d1XqcZFGi6M3YOIV1osnCg eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.G6Nny2XGFBtLfgrL0cPtC35a5yZkANTXmCQNlV4d91wNW1FSZWdHhTC9uwn5OaGq8TaeSlg3SLdt02ypmx38WenTc1zFbSjElfVWm8nQJP689ggy5EL0vTIXczbzwKk3Y7KVFAH0g4Xi_Lr6SdJJTIZREACkKcVDWVod44e32bFF7iF-u9vhIQ0GpB76d-WFJgSzBlh4ojBrCA_un2ItjJ3rVPfJi00VbTkh8fiovOsiTWg1MhgcTDyh78tqlD-f9fdeP4W5a88-v7l6H45ttrmhfPFyT46Xju7uhtdLX5MwtqZ_augSelw8qkXmUVM_yNqBDA04HGJBSGxT8rKWKg.QuQsEmFZNiVkEwAJ.XuYkMZlmfeQRaHFpRCg0Y6Ynkj7bxHyPLQ1Okmnk-F7HGogeaS4zxrbc9GQK_EKe5mEaDE_NkS76tAABChSnsXONmTezeRakyatc00PZYykARf2dwodwENI9rrHqZFJqnC0l5moFQyC9iFICeLP9RVdQ9DZhc0t-GU2hCK_CglZ09Ag2eHtvi8x75483_x_ZtVkpF1vsMXOxUMCDO_wCVcWy6o-Fkx7gPBR6AR56qD-MRBGeNn975IQ3bV1fxRTYnvRC3tX6xslZoQ6M-lIZTWFTTvZkEWYe3FSwD2HYUbm7rI4iivoNsFzmsMl38SqSQ_s_MyLcju9CcJsVmXokixKk-TcVCoDDG62gUQWTXEG4jz2sMxfwU4H2Fgg7AlFh2_At3gSVr2GXdgMtB1TYr0e1KQIVW_3DbNtYi6_neHg.k_x3SoJ2TUSAx_awKAYQWw

View File

@ -1,27 +1,37 @@
build: build:
image: golang:1.5 image: golang:1.5
environment: environment:
- GO15VENDOREXPERIMENT=1
- GOOS=linux
- GOARCH=amd64
- CGO_ENABLED=0 - CGO_ENABLED=0
commands: commands:
- go get - make deps
- go build - make vet
- go test - make build
- make test
publish: publish:
coverage:
when:
branch: master
docker: docker:
username: drone username: $$DOCKER_USER
password: $$DOCKER_PASS password: $$DOCKER_PASS
email: $$DOCKER_EMAIL email: $$DOCKER_EMAIL
repo: plugins/drone-docker repo: plugins/drone-docker
tag: latest
when: when:
branch: master branch: master
docker:
username: $$DOCKER_USER
password: $$DOCKER_PASS
email: $$DOCKER_EMAIL
repo: plugins/drone-docker
tag: develop
when:
branch: develop
plugin: plugin:
name: Docker name: Docker
desc: Build and Publish images to a Docker registry. desc: Build and publish images to a Docker registry
type: publish type: publish
image: plugins/drone-docker image: plugins/drone-docker
labels: labels:

32
Makefile Normal file
View File

@ -0,0 +1,32 @@
.PHONY: clean deps fmt vet test docker
EXECUTABLE ?= drone-docker
IMAGE ?= plugins/$(EXECUTABLE)
CI_BUILD_NUMBER ?= 0
LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')"
PACKAGES = $(shell go list ./... | grep -v /vendor/)
clean:
go clean -i ./...
deps:
go get -t ./...
fmt:
go fmt $(PACKAGES)
vet:
go vet $(PACKAGES)
test:
@for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
docker:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-s -w $(LDFLAGS)'
docker build --rm -t $(IMAGE) .
$(EXECUTABLE): $(wildcard *.go)
go build -ldflags '-s -w $(LDFLAGS)'
build: $(EXECUTABLE)

View File

@ -1,41 +1,57 @@
# drone-docker # drone-docker
[![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-docker/status.svg)](http://beta.drone.io/drone-plugins/drone-docker) [![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-docker/status.svg)](http://beta.drone.io/drone-plugins/drone-docker)
[![Coverage Status](https://aircover.co/badges/drone-plugins/drone-docker/coverage.svg)](https://aircover.co/drone-plugins/drone-docker)
[![](https://badge.imagelayers.io/plugins/drone-docker:latest.svg)](https://imagelayers.io/?images=plugins/drone-docker:latest 'Get your own badge on imagelayers.io') [![](https://badge.imagelayers.io/plugins/drone-docker:latest.svg)](https://imagelayers.io/?images=plugins/drone-docker:latest 'Get your own badge on imagelayers.io')
Drone plugin for publishing Docker images Drone plugin to build and publish images to a Docker registry
## Docker ## Docker
Build the Docker container: Build the container using `make`:
```sh ```
docker build --rm=true -t plugins/drone-docker . make deps docker
``` ```
Build and Publish a Docker container ### Example
```sh ```sh
docker run -i --privileged -v $(pwd):/drone/src plugins/drone-docker <<EOF docker run -i --privileged -v $(pwd):/drone/src plugins/drone-docker <<EOF
{ {
"workspace": { "repo": {
"path": "/drone/src" "clone_url": "git://github.com/drone/drone",
}, "owner": "drone",
"build" : { "name": "drone",
"number": 1, "full_name": "drone/drone"
"head_commit": { },
"sha": "9f2849d5", "system": {
"branch": "master", "link_url": "https://beta.drone.io"
"ref": "refs/heads/master" },
} "build": {
}, "number": 22,
"vargs": { "status": "success",
"username": "kevinbacon", "started_at": 1421029603,
"password": "pa$$word", "finished_at": 1421029813,
"email": "foo@bar.com", "message": "Update the Readme",
"repo": "foo/bar", "author": "johnsmith",
"storage_driver": "aufs" "author_email": "john.smith@gmail.com"
} "event": "push",
"branch": "master",
"commit": "436b7a6e2abaddfd35740527353e78a227ddcb2c",
"ref": "refs/heads/master"
},
"workspace": {
"root": "/drone/src",
"path": "/drone/src/github.com/drone/drone"
},
"vargs": {
"username": "kevinbacon",
"password": "pa$$word",
"email": "foo@bar.com",
"repo": "foo/bar",
"storage_driver": "aufs"
}
} }
EOF EOF
``` ```

View File

@ -40,7 +40,13 @@ type Docker struct {
BuildArgs []string `json:"build_args"` BuildArgs []string `json:"build_args"`
} }
var (
buildDate string
)
func main() { func main() {
fmt.Printf("Drone Docker Plugin built at %s\n", buildDate)
workspace := plugin.Workspace{} workspace := plugin.Workspace{}
build := plugin.Build{} build := plugin.Build{}
vargs := Docker{} vargs := Docker{}