buildall-src push script #96
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 intermediate image from indimail-docker/indimail-src. | |
# The images are common for both indimail and indimail-mta. | |
# The images have all packages required by indimail, indimail-mta compiled and installed. | |
# Using these images instead of the base images reduces build times. | |
# The images built here are used by build-bin-from-src.yml to build final runtime images. | |
name: buildall-src 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 source images | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v2 | |
- name: login | |
run: | | |
echo "${{ secrets.DOCKER_PAT }}" | docker login docker.io --username cprogrammer --password-stdin | |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io --username "${{ github.repository_owner }}" --password-stdin | |
- name: build | |
run: | | |
set +e | |
echo "Input=${{ github.event.inputs.distro_list }}" | |
if [ -z "${{ github.event.inputs.distro_list }}" ] ; then | |
distros="alpine archlinux stream8 stream9 ubi8 ubi9 fedora gentoo" | |
else | |
distros="${{ github.event.inputs.distro_list }}" | |
fi | |
flag="" | |
for i in $distros | |
do | |
echo "Using indimail-src/$i.src for build" | |
cp indimail-src/$i.src Dockerfile | |
docker build --tag "docker.io/cprogrammer/indimail-src:$i" . > $i.log 2>&1 | |
if [ $? -eq 0 ] ; then | |
docker image tag "docker.io/cprogrammer/indimail-src:$i" "ghcr.io/${{ github.repository_owner }}/indimail-src:$i" | |
echo "docker push docker.io/cprogrammer/indimail-src:$i" | |
docker push docker.io/cprogrammer/indimail-src:$i | |
echo "docker push ghcr.io/${{ github.repository_owner }}/indimail-src:$i" | |
docker push ghcr.io/${{ github.repository_owner }}/indimail-src:$i | |
else | |
cat $i.log | |
flag="$flag $i" | |
fi | |
/bin/rm -f Dockerfile | |
gzip $i.log | |
done | |
if [ -n "$flag" ] ; then | |
echo "docker build failed for $flag" | |
exit 1 | |
fi | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: buildall-src-logs | |
path: '*.log.gz' |