Skip to content

Commit

Permalink
Merge pull request #14 from Intellection/release_to_docker_hub
Browse files Browse the repository at this point in the history
Update release workflow to publish Docker image on Docker Hub
  • Loading branch information
itskingori authored Nov 20, 2024
2 parents 81480c1 + f1a1b27 commit e913b5c
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 23 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- "[0-9].[0-9]+.[0-9]+"

env:
IMAGE: zappi/resque-exporter

jobs:
github-release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -48,3 +51,43 @@ jobs:
md5sum: true
sha256sum: true
asset_name: resque-exporter-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}

docker-hub-release:
runs-on: ubuntu-latest
needs: release-binaries
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare Image Metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login To Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build, tag, and push image to Docker Hub
uses: docker/build-push-action@v6
with:
build-args:
RESQUE_EXPORTER_VERSION=${{ github.ref_name }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: linux/amd64,linux/arm64
push: true
annotations: ${{ steps.metadata.outputs.annotations }}
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
- name: Update Description On Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE }}
15 changes: 0 additions & 15 deletions .promu.yml

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 0.4.0

* Migrate from Dep to Go modules.
* Remove vendored packages.
* Upgrade `github.com/prometheus/client_golang` to `v1.20.4`.
* Upgrade `github.com/prometheus/common` to `v0.60.1`.
* Switch from `github.com/prometheus/common/log` to `github.com/sirupsen/logrus`.
* Improve setting and fetching of version information.
* Minor updates to account for package upgrades.

## 0.3.0

#### Changed
Expand Down
27 changes: 19 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
FROM quay.io/prometheus/golang-builder as builder
FROM ubuntu:24.04 AS builder

COPY . $GOPATH/src/github.com/Intellection/resque-exporter
WORKDIR $GOPATH/src/github.com/Intellection/resque-exporter
ARG DEBIAN_FRONTEND=noninteractive
ARG TARGETARCH
ARG TARGETOS

RUN make PREFIX=/
RUN apt-get update -qq -y && \
apt-get install --no-install-recommends -qq -y \
ca-certificates \
wget && \
rm -rf /var/lib/apt/lists/*

FROM quay.io/prometheus/busybox
MAINTAINER Satoshi Matsumoto <[email protected]>
ARG RESQUE_EXPORTER_VERSION
ARG RESQUE_EXPORTER_PKG="resque-exporter-${RESQUE_EXPORTER_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz"
RUN cd /tmp/ && \
wget --progress=dot:giga https://github.com/Intellection/resque-exporter/releases/download/${RESQUE_EXPORTER_VERSION}/${RESQUE_EXPORTER_PKG} && \
wget --progress=dot:giga https://github.com/Intellection/resque-exporter/releases/download/${RESQUE_EXPORTER_VERSION}/${RESQUE_EXPORTER_PKG}.sha256 && \
echo "$(cat ${RESQUE_EXPORTER_PKG}.sha256) *${RESQUE_EXPORTER_PKG}" | sha256sum -c - && \
tar --no-same-owner -xzf ${RESQUE_EXPORTER_PKG}

COPY --from=builder /resque-exporter /bin/resque-exporter
FROM ubuntu:24.04

USER nobody:nogroup
COPY --from=builder /tmp/resque-exporter /bin/resque-exporter

USER nobody:nogroup
EXPOSE 9447
ENTRYPOINT ["/bin/resque-exporter"]

0 comments on commit e913b5c

Please sign in to comment.