buildall-web-from-src push script #45
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-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 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 | |
echo "Input=${{ github.event.inputs.distro_list }}" | |
if [ -z "${{ github.event.inputs.distro_list }}" ] ; then | |
distros=indimail-src/*web.bin | |
else | |
distros="${{ github.event.inputs.distro_list }}" | |
fi | |
flag="" | |
for i in $distros | |
do | |
name=$(basename $i |cut -d. -f1,2) | |
tag=$(basename $i |cut -d. -f1) | |
image=$(basename $i |cut -d. -f2) | |
if [ -d indimail-web/$tag ] ; then | |
tag="$tag".s | |
fi | |
echo "Building web container for $name $image:$tag" | |
cp $i Dockerfile | |
docker build --tag "ghcr.io/${{ github.repository_owner }}/$image:$tag" . > $name.log 2>&1 | |
if [ $? -eq 0 ] ; then | |
echo "docker push ghcr.io/${{ github.repository_owner }}/$image:$tag" | |
docker push "ghcr.io/${{ github.repository_owner }}/$image:$tag" | |
docker image tag "ghcr.io/${{ github.repository_owner }}/$image:$tag" docker.io/cprogrammer/$image:$tag | |
echo "docker push docker.io/cprogrammer/$image:$tag" | |
docker push docker.io/cprogrammer/$image:$tag | |
else | |
cat $name.log | |
flag="$flag $name" | |
fi | |
/bin/rm -f Dockerfile | |
gzip $name.log | |
done | |
if [ -n "$flag" ] ; then | |
echo "docker build failed for $flag" | |
exit 1 | |
fi | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: buildall-web-from-src-logs | |
path: '*.log.gz' |