Skip to content

Commit

Permalink
Upd: Add Debian building to the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
bokysan committed Oct 27, 2023
1 parent b45c4ac commit 2d21a4f
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-postfix-exporter/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ runs:
context: postfix_exporter
push: true
tags: '${{ inputs.tags }}'
platforms: "linux/arm/v6,linux/arm/v7,linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
platforms: "linux/386,linux/arm/v5,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x,linux/riscv64"
cache-from: type=local,src=/tmp/.buildx-cache/postfix-exporter,mode=max,compression=estargz
cache-to: type=local,dest=/tmp/.buildx-cache-new/postfix-exporter

Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,48 @@ jobs:
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Build_Debian:
runs-on: ubuntu-latest
needs:
- Unit_Tests
- Integration_Tests
- Helm_chart_Tests
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4

# Buildkit setup
- uses: ./.github/actions/buildx-setup

# Docker hub login
- uses: ./.github/actions/docker-hub-login
with:
DOCKER_ACCESS_TOKEN: '${{ secrets.DOCKER_ACCESS_TOKEN }}'

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
#key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
key: ${{ runner.os }}-debian-${{ github.sha }}
restore-keys: |
${{ runner.os }}-debian-
- name: Build and push Debian
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: boky/postfix:edge-debian
platforms: "linux/386,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/amd64,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x"
cache-from: type=local,src=/tmp/.buildx-cache/debian,mode=max,compression=estargz
cache-to: type=local,dest=/tmp/.buildx-cache-new/debian
build-args: |
BASE_IMAGE=debian:bookworm
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
51 changes: 51 additions & 0 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,57 @@ jobs:
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Build_Debian:
runs-on: ubuntu-latest
needs:
- Unit_Tests
- Integration_Tests
- Helm_chart_Tests
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Buildkit setup
- uses: ./.github/actions/buildx-setup

# Docker hub login
- uses: ./.github/actions/docker-hub-login
with:
DOCKER_ACCESS_TOKEN: '${{ secrets.DOCKER_ACCESS_TOKEN }}'

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
#key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
key: ${{ runner.os }}-debian-${{ github.sha }}
restore-keys: |
${{ runner.os }}-debian-
- name: Build and push Debian
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
boky/postfix:latest-debian
boky/postfix:${{ env.RELEASE_VERSION }}-debian
boky/postfix:${{ env.RELEASE_VERSION_NO_v }}-debian
platforms: "linux/386,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/amd64,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x"
cache-from: type=local,src=/tmp/.buildx-cache/debian,mode=max,compression=estargz
cache-to: type=local,dest=/tmp/.buildx-cache-new/debian
build-args: |
BASE_IMAGE=debian:bookworm
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Release:
runs-on: ubuntu-latest
needs:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.2

ARG BASE_IMAGE=alpine:latest
ARG BASE_IMAGE=debian:latest
# ARG BASE_IMAGE=ubuntu:jammy

FROM ${BASE_IMAGE} AS build-scripts
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ Several potentially "surprising" changes went into this issue and hence warrant
- Image now builds its own version of [postfix-exporter](https://github.com/kumina/postfix_exporter) and relies on this
third-party project. Checkout is from master branch, based
on specific SHA commit id. The same hash is used for master and tags.
- **Architecture galore!** With the addition of debian images, we now support support more architectures than ever. The list includes:
`linux/386`, `linux/amd64`, `linux/arm/v5`, `linux/arm/v6`, `linux/arm/v7`, `linux/arm64`, `linux/arm64/v8`, `linux/mips64le`,
`linux/ppc64le` and `linux/s390x`.

### v3.0.0

Expand Down
9 changes: 8 additions & 1 deletion build-scripts/postfix-install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/sh
set -e

if [ -f /etc/os-release ]; then
. /etc/os-release
fi

do_alpine() {
apk update
Expand All @@ -11,13 +14,17 @@ do_alpine() {
}

do_ubuntu() {
RELEASE_SPECIFIC_PACKAGES="netcat"
if [ "${ID}" -eq "debian" ]; then
RELEASE_SPECIFIC_PACKAGES="netcat-openbsd"
fi
export DEBIAN_FRONTEND=noninteractive
echo "Europe/Berlin" > /etc/timezone
apt-get update -y -q
apt-get install -y libsasl2-modules
apt-get install -y postfix
apt-get install -y opendkim
apt-get install -y ca-certificates tzdata supervisor rsyslog bash opendkim-tools curl libcurl4 libjsoncpp25 sasl2-bin postfix-lmdb netcat logrotate cron
apt-get install -y ca-certificates tzdata supervisor rsyslog bash opendkim-tools curl libcurl4 libjsoncpp25 sasl2-bin postfix-lmdb logrotate cron
}

if [ -f /etc/alpine-release ]; then
Expand Down
7 changes: 4 additions & 3 deletions build-scripts/sasl-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ do_build() {
}

if [ -f /etc/alpine-release ]; then
apk add --upgrade --virtual .build-deps git cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev patch
apk add --upgrade --virtual .build-deps git cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev patch pandoc
do_build
apk del .build-deps;
else
. /etc/lsb-release
[ -f /etc/lsb-release ] && . /etc/lsb-release
[ -f /etc/os-release ] && . /etc/os-release
apt-get update -y -qq
LIBS="git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev"
LIBS="git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev pandoc"
apt-get install -y --no-install-recommends ${LIBS}
do_build
apt-get remove --purge -y ${LIBS}
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ fi
# arg_list="$arg_list --platform linux/amd64,linux/arm64,linux/arm/v7"
#fi

docker buildx build ${arg_list} . $*
docker buildx build ${arg_list} $* .

0 comments on commit 2d21a4f

Please sign in to comment.