Skip to content

Commit

Permalink
Update f2b-exporter to 0.9, add publish workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Thilo Fromm <[email protected]>
  • Loading branch information
t-lo committed Jun 27, 2023
1 parent ffed7b9 commit a210e88
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 5 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/publish-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and Publish the mailserver Docker Image to GHCR.io

# Manually-triggered action to build the latest version (or optionally, if provided, a release tag)
# of mailserver.

on:
workflow_dispatch:
inputs:
version_tag:
description: Optional version tag to build. Defaults to latest main.
required: false
tag_as_latest:
description: Also tag image as latest (in addition to tag supplied / computed).
type: boolean
default: 0

jobs:
build_and_publish_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: mailserver
fetch-depth: 0

- name: Optionally Check Out Tag
if: ${{ inputs.version_tag }}
# work around https://github.com/actions/runner/issues/665
shell: bash
env:
VERSION_TAG: ${{ inputs.version_tag }}
run: |
cd mailserver
git checkout "$VERSION_TAG"
- name: Grok image tag
run: |
cd mailserver
git describe --tags | tee SRC_TAG
echo "ghcr.io/t-lo/mailserver:$(cat SRC_TAG)-models" | tee IMAGE_TAG
- name: Build the docker image
run: |
cd mailserver
tag=$(cat IMAGE_TAG)
docker build -t "$(cat IMAGE_TAG)" .
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Image
run: |
docker push "$(cat mailserver/IMAGE_TAG)"
- name: Optionally Tag Image as Latest
if: ${{ inputs.tag_as_latest }}
run: |
docker tag "$(cat mailserver/IMAGE_TAG)" ghcr.io/t-lo/mailserver:latest
docker push ghcr.io/t-lo/mailserver:latest
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# First, build the metrics exporter and the "prips" (print ip ranges) tool.
FROM alpine AS builder
ARG postfix_exporter_version=0.3.0
ARG fail2ban_exporter_version=0.7.2
ARG fail2ban_exporter_version=0.9.0
ARG prips_version=1.2.0

RUN apk update \
Expand All @@ -18,10 +18,10 @@ RUN cd "/postfix_exporter-$postfix_exporter_version" \
&& mv postfix_exporter /

RUN echo "Downloading and building fail2ban exporter version '$fail2ban_exporter_version'" \
&& wget "https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/archive/${fail2ban_exporter_version}/fail2ban-prometheus-exporter-${fail2ban_exporter_version}.tar.gz" \
&& tar -xzvf "fail2ban-prometheus-exporter-${fail2ban_exporter_version}.tar.gz"
&& wget "https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/archive/v${fail2ban_exporter_version}/fail2ban-prometheus-exporter-v${fail2ban_exporter_version}.tar.gz" \
&& tar -xzvf "fail2ban-prometheus-exporter-v${fail2ban_exporter_version}.tar.gz"

RUN cd "/fail2ban-prometheus-exporter-${fail2ban_exporter_version}/src" \
RUN cd "/fail2ban-prometheus-exporter-v${fail2ban_exporter_version}" \
&& go mod download \
&& go build \
&& strip fail2ban-prometheus-exporter \
Expand Down
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ untracked="$(git ls-files --other --exclude-standard --directory 2>&1)"
if [ -n "${untracked}" ] ; then
echo
git ls-files --other --exclude-standard --directory 2>&1
yell "ERROR: untracked files detected (see baove). Please commit and push or remove bevore creating a release."
yell "ERROR: untracked files detected (see above). Please commit and push or remove before creating a release."
exit 1
fi

Expand Down

0 comments on commit a210e88

Please sign in to comment.