Skip to content

Commit 757e748

Browse files
authored
Feature/autobuild docker image for each release thru dockerhub auto builds (roboll#886)
* feat: build hook for dockerhub autobuilds * release new image * Create pre_build * Update push
1 parent e6f1db1 commit 757e748

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

hooks/build

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
echo "=> Building container"
4+
docker build \
5+
--tag "$IMAGE_NAME" \
6+
--file Dockerfile .

hooks/pre_build

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
go()
4+
{
5+
docker run --rm -v "$(pwd):/workspace" -w /workspace golang:latest go $@;
6+
}
7+
8+
go get -u github.com/tcnksm/ghr github.com/mitchellh/gox
9+
go mod vendor

hooks/push

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
echo "=> Fetch unshallow origin"
4+
git fetch --unshallow origin || true
5+
6+
echo "=> Tag image:"
7+
docker tag "${IMAGE_NAME}" "${DOCKER_REPO}:$(git describe --tags --abbrev=0 HEAD^)"
8+
docker tag "${IMAGE_NAME}" "${DOCKER_REPO}:$(git describe --tags --abbrev=0 HEAD)"
9+
10+
echo "=> Push images"
11+
docker push "${DOCKER_REPO}"

0 commit comments

Comments
 (0)