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