From 9aa7f887565d9309a7f085a8bc522920dcd36959 Mon Sep 17 00:00:00 2001 From: Peter Grace Date: Sat, 5 Dec 2020 14:24:43 +0000 Subject: [PATCH] use makefile to generate image --- .github/workflows/docker-image.yml | 12 +++++++++--- Makefile | 11 +++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 691fb9f..5af84c3 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -13,6 +13,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag petergrace/opentsdb-docker:latest + - uses: actions/checkout@v2 + - name: Login to dockerhub + uses: docker/login-action@v1 + with: + username: ${{ secrets.HUB_DOCKER_USERNAME }} + password: ${{ secrets.HUB_DOCKER_PAT }} + - name: run makefile + run: make gh-build + shell: bash diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8ef175e --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +all: build + +build: + docker build -t petergrace/opentsdb-docker . + +gh-build: HASH=$(shell git rev-parse --short HEAD) +gh-build: + docker build -t petergrace/opentsdb-docker:$(HASH) . + docker tag petergrace/opentsdb-docker:$(HASH) petergrace/opentsdb-docker:latest + docker push petergrace/opentsdb-docker:$(HASH) + docker push petergrace/opentsdb-docker:latest