From 63eaeb0e470f6de9f4d1d37196724d61f4de6f71 Mon Sep 17 00:00:00 2001 From: Josh Gwosdz Date: Fri, 7 May 2021 11:19:50 +0200 Subject: [PATCH] publish a docker image to quay for every release (#86) * publish a docker image to quay for every release Signed-off-by: Josh Gwosdz * quote secret injection Signed-off-by: Josh Gwosdz * clean up build workflow Signed-off-by: Josh Gwosdz --- .github/workflows/build-docker.yaml | 26 ++++++++++++++++++++++ .github/workflows/{main.yaml => test.yaml} | 0 Dockerfile | 6 ++--- Makefile | 1 + 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-docker.yaml rename .github/workflows/{main.yaml => test.yaml} (100%) diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml new file mode 100644 index 0000000..752d673 --- /dev/null +++ b/.github/workflows/build-docker.yaml @@ -0,0 +1,26 @@ +name: build-docker + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: 1.14.x + - uses: actions/checkout@v2 + - name: Login to quay.io Docker Image Registry + uses: docker/login-action@v1 + with: + registry: quay.io + username: "${{ secrets.QUAY_USER }}" + password: "${{ secrets.QUAY_PASS }}" + - run: make docker docker-publish + env: + DOCKER_IMAGE_TAG: ${{ github.event.release.tag_name }} + - run: make docker docker-publish + env: + DOCKER_IMAGE_TAG: latest diff --git a/.github/workflows/main.yaml b/.github/workflows/test.yaml similarity index 100% rename from .github/workflows/main.yaml rename to .github/workflows/test.yaml diff --git a/Dockerfile b/Dockerfile index de0d284..c2931bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ -FROM circleci/golang:1.14 AS builder -COPY . /go/src/github.com/prometheus-community/jiralert -RUN mkdir -p /go/src/github.com/prometheus-community/jiralert && sudo chown -R circleci:circleci /go/src/github.com/prometheus-community/ +FROM golang:1.14 AS builder WORKDIR /go/src/github.com/prometheus-community/jiralert +COPY . /go/src/github.com/prometheus-community/jiralert RUN GO111MODULE=on GOBIN=/tmp/bin make FROM quay.io/prometheus/busybox-linux-amd64:latest @@ -9,4 +8,3 @@ FROM quay.io/prometheus/busybox-linux-amd64:latest COPY --from=builder /go/src/github.com/prometheus-community/jiralert/jiralert /bin/jiralert ENTRYPOINT [ "/bin/jiralert" ] - diff --git a/Makefile b/Makefile index 90e1d97..638aea2 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +DOCKER_REPO ?= quay.io/jiralert DOCKER_IMAGE_NAME ?= jiralert include Makefile.common