Update to Docker Hub automated build
This commit is contained in:
parent
0dbfcce537
commit
0c46942410
10
.dockerignore
Normal file
10
.dockerignore
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/.env
|
||||||
|
/.gitignore
|
||||||
|
/Docker*
|
||||||
|
/DOCS.md
|
||||||
|
/LICENSE
|
||||||
|
/logo.svg
|
||||||
|
/MAINTAINERS
|
||||||
|
/Makefile
|
||||||
|
/publish.sh
|
||||||
|
/README.md
|
|
@ -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
|
FROM alpine:3.4
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates
|
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"]
|
ENTRYPOINT ["/bin/drone-email"]
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -1,4 +1,4 @@
|
||||||
all: test build publish
|
all: test build
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go vet
|
go vet
|
||||||
|
@ -6,7 +6,3 @@ test:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
|
||||||
docker build -t drillster/drone-email:latest .
|
|
||||||
|
|
||||||
publish:
|
|
||||||
bash publish.sh
|
|
|
@ -18,7 +18,7 @@ go build
|
||||||
Build the docker image with the following commands:
|
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`.
|
This will create a Docker image called `drillster/drone-email:latest`.
|
||||||
|
|
25
publish.sh
25
publish.sh
|
@ -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
|
|
Loading…
Reference in a new issue