Process code review remarks

- Moved run to bottom of Dockerfile to allow using unmodified / cached states.
- Simplified bash code in deploy.sh.
- Improved the large bash one-liner in CI.yml. It could not handle >9 for 1.x.
master
Dimitri Huisman 3 years ago
parent 56dd70cf4a
commit f7677543c6

@ -27,8 +27,8 @@ on:
# Code block that is used as one liner.
##!/bin/bash
#version=$( git tag --list "{{ env.MAILU_VERSION }}.*" | tail -1 )
#root_version=${version:0:3}
#patch_version=${version:4:4}
#root_version=${version%.*}
#patch_version=${version##*.}
#if [ "$patch_version" == "" ]
#then
# pinned_version={{ env.MAILU_VERSION }}.0
@ -73,7 +73,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }}
shell: bash
@ -149,7 +149,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }}
shell: bash
@ -221,7 +221,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }}
shell: bash
@ -293,7 +293,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }}
shell: bash
@ -365,7 +365,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }}
shell: bash
@ -437,7 +437,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }}
shell: bash
@ -509,7 +509,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }}
shell: bash
@ -587,7 +587,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }}
shell: bash
@ -649,7 +649,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }}
shell: bash
run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version:0:3};patch_version=${version:4:4};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Tag and create release
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' && env.PINNED_MAILU_VERSION != '' }}
uses: ncipollo/release-action@v1

@ -27,7 +27,6 @@ COPY --from=balenalib/rpi-alpine:3.14 /usr/bin/qemu-arm-static /usr/bin/qemu-arm
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN set -eu \
@ -60,3 +59,4 @@ ENV FLASK_APP mailu
CMD /start.py
HEALTHCHECK CMD curl -f -L http://localhost/sso/login?next=ui.index || exit 1
RUN echo $VERSION >> /version

@ -15,7 +15,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -44,3 +43,4 @@ VOLUME ["/mail"]
CMD /start.py
HEALTHCHECK --start-period=350s CMD echo QUIT|nc localhost 110|grep "Dovecot ready."
RUN echo $VERSION >> /version

@ -5,7 +5,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -32,3 +31,4 @@ VOLUME ["/overrides"]
CMD /start.py
HEALTHCHECK CMD curl -k -f -L http://localhost/health || exit 1
RUN echo $VERSION >> /version

@ -6,7 +6,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -35,3 +34,4 @@ VOLUME ["/queue"]
CMD /start.py
HEALTHCHECK --start-period=350s CMD echo QUIT|nc localhost 25|grep "220 .* ESMTP Postfix"
RUN echo $VERSION >> /version

@ -4,7 +4,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -29,3 +28,4 @@ VOLUME ["/var/lib/rspamd"]
CMD /start.py
HEALTHCHECK --start-period=350s CMD curl -f -L http://localhost:11334/ || exit 1
RUN echo $VERSION >> /version

@ -23,7 +23,6 @@ ARG pinned_version=master
ENV VERSION=$version
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $pinned_version >> /version
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /build/$VERSION /build/$VERSION
@ -31,3 +30,4 @@ COPY --from=build /build/$VERSION /build/$VERSION
EXPOSE 80/tcp
CMD nginx -g "daemon off;"
RUN echo $pinned_version >> /version

@ -5,7 +5,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -24,3 +23,4 @@ VOLUME ["/data"]
CMD /start.py
HEALTHCHECK --start-period=350s CMD /health.sh
RUN echo $VERSION >> /version

@ -5,7 +5,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -20,4 +19,5 @@ RUN mkdir -p /data
COPY fetchmail.py /fetchmail.py
CMD ["/fetchmail.py"]
CMD ["/fetchmail.py"]
RUN echo $VERSION >> /version

@ -5,7 +5,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -41,3 +40,4 @@ EXPOSE 5432
CMD /start.py
HEALTHCHECK CMD psql -h 127.0.0.1 -d postgres -U health -c "select 1 as ok;" || exit 1
RUN echo $VERSION >> /version

@ -5,7 +5,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -25,3 +24,4 @@ VOLUME ["/data"]
CMD radicale -S -C /radicale.conf
HEALTHCHECK CMD curl -f -L http://localhost:5232/ || exit 1
RUN echo $VERSION >> /version

@ -4,7 +4,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
RUN apk --no-cache add inotify-tools util-linux bash tzdata
@ -14,3 +13,4 @@ VOLUME ["/traefik"]
VOLUME ["/output"]
ENTRYPOINT ["/run.sh"]
RUN echo $VERSION >> /version

@ -5,7 +5,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# python3 shared with most images
RUN apk add --no-cache \
@ -31,3 +30,4 @@ EXPOSE 53/udp 53/tcp
CMD /start.py
HEALTHCHECK CMD dig @127.0.0.1 || exit 1
RUN echo $VERSION >> /version

@ -3,7 +3,7 @@ FROM $DISTRO
ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
RUN mkdir -p /app
WORKDIR /app
@ -21,3 +21,4 @@ COPY static ./static
EXPOSE 80/tcp
CMD gunicorn -w 4 -b :80 --access-logfile - --error-logfile - --preload main:app
RUN echo $VERSION >> /version

@ -17,7 +17,7 @@ fi
#After that, both tags are pushed to the docker repository.
if [ "$PINNED_MAILU_VERSION" != "" ] && [ "$BRANCH" != "master" ]
then
images=$(docker-compose -f tests/build.yml config | grep 'image: ' | awk -F ':' '{ print $2 }')
images=$(docker-compose -f Mailu/tests/build.yml config | awk -F ':' '/image:/{ print $2 }')
for image in $images
do
docker tag "${image}":"${PINNED_MAILU_VERSION}" "${image}":${MAILU_VERSION}
@ -36,7 +36,7 @@ fi
#Then we publish the images with tag master
if [ "$PINNED_MAILU_VERSION" != "" ] && [ "$BRANCH" == "master" ]
then
images=$(docker-compose -f tests/build.yml config | grep 'image: ' | awk -F ':' '{ print $2 }')
images=$(docker-compose -f Mailu/tests/build.yml config | awk -F ':' '/image:/{ print $2 }')
for image in $images
do
docker tag "${image}":"${PINNED_MAILU_VERSION}" "${image}":${MAILU_VERSION}

@ -8,7 +8,6 @@ ONBUILD COPY --from=balenalib/rpi-alpine:3.14 /usr/bin/qemu-arm-static /usr/bin/
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
# Shared later between dovecot postfix nginx rspamd rainloop and roundloop
RUN apk add --no-cache \
@ -75,3 +74,4 @@ VOLUME ["/data"]
CMD php-fpm7 && /start.py
HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1
RUN echo $VERSION >> /version

@ -11,7 +11,6 @@ ARG VERSION
ENV TZ Etc/UTC
LABEL version=$VERSION
RUN echo $VERSION >> /version
#Shared layer between rainloop and roundcube
RUN apt-get update && apt-get install -y \
@ -62,3 +61,4 @@ VOLUME ["/data"]
CMD /start.py
HEALTHCHECK CMD curl -f -L -H 'User-Agent: health' http://localhost/ || exit 1
RUN echo $VERSION >> /version
Loading…
Cancel
Save