Update to Docker Hub automated build

This commit is contained in:
Michael de Wit 2018-02-08 16:50:01 +01:00
parent 0dbfcce537
commit 0c46942410
5 changed files with 20 additions and 32 deletions

10
.dockerignore Normal file
View file

@ -0,0 +1,10 @@
/.env
/.gitignore
/Docker*
/DOCS.md
/LICENSE
/logo.svg
/MAINTAINERS
/Makefile
/publish.sh
/README.md

View file

@ -1,6 +1,13 @@
FROM golang:1.8-alpine as builder
WORKDIR /go/src/drone-email
COPY . .
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
FROM alpine:3.4
RUN apk add --no-cache ca-certificates
ADD drone-email /bin/
COPY --from=builder /go/src/drone-email/drone-email /bin/
ENTRYPOINT ["/bin/drone-email"]

View file

@ -1,4 +1,4 @@
all: test build publish
all: test build
test:
go vet
@ -6,7 +6,3 @@ test:
build:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
docker build -t drillster/drone-email:latest .
publish:
bash publish.sh

View file

@ -18,7 +18,7 @@ go build
Build the docker image with the following commands:
```
make build
docker build -t drillster/drone-email:latest .
```
This will create a Docker image called `drillster/drone-email:latest`.

View file

@ -1,25 +0,0 @@
#!/bin/bash
tags=$(git tag --points-at HEAD)
IFS=$'\n' read -rd '' -a taglist <<<"$tags"
if [ ${#taglist[@]} -gt 0 ]; then
echo "Tagging Docker images with: ${taglist[@]}"
for tag in "${taglist[@]}"; do
docker tag drillster/drone-email:latest drillster/drone-email:$tag
done
fi
echo "Pushing Docker images..."
docker push drillster/drone-email:latest
if [ "$?" -ne "0" ]; then
echo "Failed to push image, exiting!"
exit 1
fi
if [ ${#taglist[@]} -gt 0 ]; then
for tag in "${taglist[@]}"; do
docker push drillster/drone-email:$tag
done
fi