buildall-web-from-obs push script #122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this script builds runtime images for indimail with iwebadmin and roundcube mail | |
# this script uses Dockerfile which install packages required by indimail, indimail-mta from | |
# open build service | |
name: buildall-web-from-obs push script | |
on: | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
inputs: | |
distro_list: | |
# Friendly description to be shown in the UI instead of 'name' | |
Distro List: 'distro list' | |
# Input has to be provided for the workflow to run | |
required: false | |
jobs: | |
build_and_push: | |
name: build and push container image | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v2 | |
- name: login | |
run: | | |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io --username "${{ github.repository_owner }}" --password-stdin | |
echo "${{ secrets.DOCKER_PAT }}" | docker login docker.io --username cprogrammer --password-stdin | |
- name: build | |
run: | | |
set +e | |
sudo apt-get clean | |
echo "Input=${{ github.event.inputs.distro_list }}" | |
if [ -z "${{ github.event.inputs.distro_list }}" ] ; then | |
distros="almalinux8 oracle8 rockylinux8 almalinux9 oracle9 rockylinux9 stream8" | |
distros="$distros debian10 debian11 debian12 bionic focal jammy lunar" | |
distros="$distros fc37 fc38 leap15.5 tumbleweed" | |
else | |
distros="${{ github.event.inputs.distro_list }}" | |
fi | |
flag="" | |
for i in $distros | |
do | |
if [ ! -f webmail/$i/Dockerfile ] ; then | |
echo "webmail/$i/Dockerfile not found" 1>&2 | |
continue | |
fi | |
echo "Using webmail/$i/Dockerfile for build" | |
cp webmail/$i/Dockerfile . | |
docker build --tag "ghcr.io/${{ github.repository_owner }}/indimail-web:$i" . | |
if [ $? -eq 0 ] ; then | |
echo "docker push ghcr.io/${{ github.repository_owner }}/indimail-web:$i" | |
docker push "ghcr.io/${{ github.repository_owner }}/indimail-web:$i" | |
docker image tag "ghcr.io/${{ github.repository_owner }}/indimail-web:$i" docker.io/cprogrammer/indimail-web:$i | |
echo "docker push docker.io/cprogrammer/indimail-web:$i" | |
docker push docker.io/cprogrammer/indimail-web:$i | |
else | |
flag="$flag $i" | |
fi | |
/bin/rm -f Dockerfile | |
done | |
if [ -n "$flag" ] ; then | |
echo "docker build failed for $flag" 1>&2 | |
exit 1 | |
fi |