From d251446838114c48ab1686e69852b17168482c56 Mon Sep 17 00:00:00 2001 From: Christian Loos Date: Tue, 7 Jan 2025 19:16:53 +0100 Subject: [PATCH] build also RT stable and master from GitHub repo --- .github/workflows/build.yml | 6 +++-- 4.4/Dockerfile | 27 ++++++++++---------- 4.4/docker-entrypoint.sh | 4 +-- 5.0/Dockerfile | 27 ++++++++++---------- 5.0/docker-entrypoint.sh | 4 +-- Dockerfile.template | 29 ++++++++++++---------- README.md | 14 +++++------ docker-entrypoint.sh | 4 +-- master/Dockerfile | 49 +++++++++++++++++++++++++++++++++++++ master/RT_SiteConfig.pm | 8 ++++++ master/docker-entrypoint.sh | 23 +++++++++++++++++ stable/Dockerfile | 49 +++++++++++++++++++++++++++++++++++++ stable/RT_SiteConfig.pm | 8 ++++++ stable/docker-entrypoint.sh | 23 +++++++++++++++++ update.sh | 39 +++++++++++++++++++---------- 15 files changed, 246 insertions(+), 68 deletions(-) create mode 100644 master/Dockerfile create mode 100644 master/RT_SiteConfig.pm create mode 100755 master/docker-entrypoint.sh create mode 100644 stable/Dockerfile create mode 100644 stable/RT_SiteConfig.pm create mode 100755 stable/docker-entrypoint.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50e3bb1..ed659c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,8 @@ jobs: version: - '4.4' - '5.0' + - 'stable' + - 'master' steps: - name: Checkout repository @@ -84,7 +86,7 @@ jobs: run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }} - name: Update Docker Hub description - if: ${{ matrix.version == '5.0' }} + if: ${{ matrix.version == 'master' }} uses: peter-evans/dockerhub-description@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -93,7 +95,7 @@ jobs: short-description: ${{ github.event.repository.description }} - uses: actions/delete-package-versions@v5 - if: ${{ matrix.version == '5.0' }} + if: ${{ matrix.version == 'master' }} with: package-name: request-tracker package-type: container diff --git a/4.4/Dockerfile b/4.4/Dockerfile index d50755e..94eb0ec 100644 --- a/4.4/Dockerfile +++ b/4.4/Dockerfile @@ -8,19 +8,20 @@ LABEL org.opencontainers.image.authors="Christian Loos " SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN gpg --keyserver keyserver.ubuntu.com --recv-keys C49B372F2BF84A19011660270DF0A283FEAC80B2 \ - && gpg --list-keys - WORKDIR /usr/local/src # hadolint ignore=DL3003,SC2174 -RUN curl -fsSL \ - -o rt.tar.gz https://download.bestpractical.com/pub/rt/release/rt-4.4.7.tar.gz \ - -o rt.tar.gz.asc https://download.bestpractical.com/pub/rt/release/rt-4.4.7.tar.gz.asc \ - && gpg --verify rt.tar.gz.asc rt.tar.gz \ +RUN curl -fsSL -o rt.tar.gz https://download.bestpractical.com/pub/rt/release/rt-4.4.7.tar.gz \ + && if [[ "https://download.bestpractical.com/pub/rt/release/rt-4.4.7.tar.gz" =~ ^https://download.bestpractical.com/pub/rt/ ]]; then \ + curl -fsSL -o rt.tar.gz.asc https://download.bestpractical.com/pub/rt/release/rt-4.4.7.tar.gz.asc; \ + gpg --keyserver keyserver.ubuntu.com --recv-keys C49B372F2BF84A19011660270DF0A283FEAC80B2; \ + gpg --list-keys; \ + gpg --verify rt.tar.gz.asc rt.tar.gz; \ + fi \ && tar -xzf rt.tar.gz \ - && cd rt-4.4.7 \ - && ./configure \ + && cd rt-* \ + && ./configure.ac \ + --prefix=/opt/rt \ --enable-developer \ --enable-externalauth \ --enable-gd \ @@ -30,17 +31,17 @@ RUN curl -fsSL \ --with-db-type=SQLite \ --with-web-handler=standalone \ && make install \ - && mkdir --mode=0600 --parents /opt/rt4/var/data/{gpg,smime} \ + && mkdir --mode=0600 --parents /opt/rt/var/data/{gpg,smime} \ && make initialize-database \ && cd .. && rm -rf /usr/local/src/* -WORKDIR /opt/rt4 +WORKDIR /opt/rt COPY RT_SiteConfig.pm etc/ -VOLUME /opt/rt4 +VOLUME /opt/rt COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 80 -CMD ["/opt/rt4/sbin/rt-server"] +CMD ["/opt/rt/sbin/rt-server"] diff --git a/4.4/docker-entrypoint.sh b/4.4/docker-entrypoint.sh index 9b143cc..a7e9bfb 100755 --- a/4.4/docker-entrypoint.sh +++ b/4.4/docker-entrypoint.sh @@ -14,10 +14,10 @@ sed -i \ -e "s/RT_MAIL_COMMAND/$RT_MAIL_COMMAND/" \ -e "s/RT_WEB_DOMAIN/$RT_WEB_DOMAIN/" \ -e "s/RT_WEB_PORT/$RT_WEB_PORT/" \ - /opt/rt4/etc/RT_SiteConfig.pm + /opt/rt/etc/RT_SiteConfig.pm if [[ -n "${RT_ROOT_PASSWORD}" ]]; then - (echo "${RT_ROOT_PASSWORD}" | /opt/rt4/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 + (echo "${RT_ROOT_PASSWORD}" | /opt/rt/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 fi exec "$@" diff --git a/5.0/Dockerfile b/5.0/Dockerfile index 0758ed2..3280030 100644 --- a/5.0/Dockerfile +++ b/5.0/Dockerfile @@ -8,19 +8,20 @@ LABEL org.opencontainers.image.authors="Christian Loos " SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN gpg --keyserver keyserver.ubuntu.com --recv-keys C49B372F2BF84A19011660270DF0A283FEAC80B2 \ - && gpg --list-keys - WORKDIR /usr/local/src # hadolint ignore=DL3003,SC2174 -RUN curl -fsSL \ - -o rt.tar.gz https://download.bestpractical.com/pub/rt/release/rt-5.0.7.tar.gz \ - -o rt.tar.gz.asc https://download.bestpractical.com/pub/rt/release/rt-5.0.7.tar.gz.asc \ - && gpg --verify rt.tar.gz.asc rt.tar.gz \ +RUN curl -fsSL -o rt.tar.gz https://download.bestpractical.com/pub/rt/release/rt-5.0.7.tar.gz \ + && if [[ "https://download.bestpractical.com/pub/rt/release/rt-5.0.7.tar.gz" =~ ^https://download.bestpractical.com/pub/rt/ ]]; then \ + curl -fsSL -o rt.tar.gz.asc https://download.bestpractical.com/pub/rt/release/rt-5.0.7.tar.gz.asc; \ + gpg --keyserver keyserver.ubuntu.com --recv-keys C49B372F2BF84A19011660270DF0A283FEAC80B2; \ + gpg --list-keys; \ + gpg --verify rt.tar.gz.asc rt.tar.gz; \ + fi \ && tar -xzf rt.tar.gz \ - && cd rt-5.0.7 \ - && ./configure \ + && cd rt-* \ + && ./configure.ac \ + --prefix=/opt/rt \ --enable-developer \ --enable-externalauth \ --enable-gd \ @@ -30,17 +31,17 @@ RUN curl -fsSL \ --with-db-type=SQLite \ --with-web-handler=standalone \ && make install \ - && mkdir --mode=0600 --parents /opt/rt5/var/data/{gpg,smime} \ + && mkdir --mode=0600 --parents /opt/rt/var/data/{gpg,smime} \ && make initialize-database \ && cd .. && rm -rf /usr/local/src/* -WORKDIR /opt/rt5 +WORKDIR /opt/rt COPY RT_SiteConfig.pm etc/ -VOLUME /opt/rt5 +VOLUME /opt/rt COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 80 -CMD ["/opt/rt5/sbin/rt-server"] +CMD ["/opt/rt/sbin/rt-server"] diff --git a/5.0/docker-entrypoint.sh b/5.0/docker-entrypoint.sh index ab5532a..a7e9bfb 100755 --- a/5.0/docker-entrypoint.sh +++ b/5.0/docker-entrypoint.sh @@ -14,10 +14,10 @@ sed -i \ -e "s/RT_MAIL_COMMAND/$RT_MAIL_COMMAND/" \ -e "s/RT_WEB_DOMAIN/$RT_WEB_DOMAIN/" \ -e "s/RT_WEB_PORT/$RT_WEB_PORT/" \ - /opt/rt5/etc/RT_SiteConfig.pm + /opt/rt/etc/RT_SiteConfig.pm if [[ -n "${RT_ROOT_PASSWORD}" ]]; then - (echo "${RT_ROOT_PASSWORD}" | /opt/rt5/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 + (echo "${RT_ROOT_PASSWORD}" | /opt/rt/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 fi exec "$@" diff --git a/Dockerfile.template b/Dockerfile.template index bbe04f7..d9977cb 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -8,19 +8,21 @@ LABEL org.opencontainers.image.authors="Christian Loos " SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN gpg --keyserver keyserver.ubuntu.com --recv-keys C49B372F2BF84A19011660270DF0A283FEAC80B2 \ - && gpg --list-keys - WORKDIR /usr/local/src # hadolint ignore=DL3003,SC2174 -RUN curl -fsSL \ - -o rt.tar.gz https://download.bestpractical.com/pub/rt/%%RT_RELEASE%%/rt-%%RT_VERSION%%.tar.gz \ - -o rt.tar.gz.asc https://download.bestpractical.com/pub/rt/%%RT_RELEASE%%/rt-%%RT_VERSION%%.tar.gz.asc \ - && gpg --verify rt.tar.gz.asc rt.tar.gz \ +RUN curl -fsSL -o rt.tar.gz %%RT_URL%% \ + && if [[ "%%RT_URL%%" =~ ^https://download.bestpractical.com/pub/rt/ ]]; then \ + curl -fsSL -o rt.tar.gz.asc %%RT_URL%%.asc; \ + gpg --keyserver keyserver.ubuntu.com --recv-keys C49B372F2BF84A19011660270DF0A283FEAC80B2; \ + gpg --list-keys; \ + gpg --verify rt.tar.gz.asc rt.tar.gz; \ + fi \ && tar -xzf rt.tar.gz \ - && cd rt-%%RT_VERSION%% \ - && ./configure \ + && cd rt-* \ + && echo "%%RT_VERSION_TAG%%.$(date -I)" > .tag \ + && ./configure.ac \ + --prefix=/opt/rt \ --enable-developer \ --enable-externalauth \ --enable-gd \ @@ -29,18 +31,19 @@ RUN curl -fsSL \ --enable-smime \ --with-db-type=SQLite \ --with-web-handler=standalone \ + && RT_FIX_DEPS_CMD=cpanm make fixdeps && rm -rf /root/.cpanm \ && make install \ - && mkdir --mode=0600 --parents /opt/rt%%RT_VERSION_MAJOR%%/var/data/{gpg,smime} \ + && mkdir --mode=0600 --parents /opt/rt/var/data/{gpg,smime} \ && make initialize-database \ && cd .. && rm -rf /usr/local/src/* -WORKDIR /opt/rt%%RT_VERSION_MAJOR%% +WORKDIR /opt/rt COPY RT_SiteConfig.pm etc/ -VOLUME /opt/rt%%RT_VERSION_MAJOR%% +VOLUME /opt/rt COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 80 -CMD ["/opt/rt%%RT_VERSION_MAJOR%%/sbin/rt-server"] +CMD ["/opt/rt/sbin/rt-server"] diff --git a/README.md b/README.md index 5e0fba9..7b4fb9d 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ - [`4.4` (4.4/*Dockerfile*)](https://github.com/cloos/docker-rt/blob/main/4.4/Dockerfile) - [`5.0`, `latest` (5.0/*Dockerfile*)](https://github.com/cloos/docker-rt/blob/main/5.0/Dockerfile) +- [`stable` (stable/*Dockerfile*)](https://github.com/cloos/docker-rt/blob/main/stable/Dockerfile) +- [`master` (master/*Dockerfile*)](https://github.com/cloos/docker-rt/blob/main/master/Dockerfile) ## Where is this image available? @@ -19,15 +21,13 @@ The images are signed with [cosign](https://github.com/sigstore/cosign). -To verrify the signature run: +To verify the signature run the following command with the respective image tag: ```shell cosign verify \ --certificate-identity-regexp https://github.com/netsandbox/docker-rt/ \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ - netsandbox/request-tracker:latest \ - netsandbox/request-tracker:5.0 \ - netsandbox/request-tracker:4.4 + netsandbox/request-tracker:latest ``` ### GitHub Container Registry @@ -35,15 +35,13 @@ cosign verify \ The images are signed with [cosign](https://github.com/sigstore/cosign). -To verrify the signature run: +To verify the signature run the following command with the respective image tag: ```shell cosign verify \ --certificate-identity-regexp https://github.com/netsandbox/docker-rt/ \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ - ghcr.io/netsandbox/request-tracker:latest \ - ghcr.io/netsandbox/request-tracker:5.0 \ - ghcr.io/netsandbox/request-tracker:4.4 + ghcr.io/netsandbox/request-tracker:latest ``` ## What is Request Tracker? diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index d6a76f0..a7e9bfb 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -14,10 +14,10 @@ sed -i \ -e "s/RT_MAIL_COMMAND/$RT_MAIL_COMMAND/" \ -e "s/RT_WEB_DOMAIN/$RT_WEB_DOMAIN/" \ -e "s/RT_WEB_PORT/$RT_WEB_PORT/" \ - /opt/rt%%RT_VERSION_MAJOR%%/etc/RT_SiteConfig.pm + /opt/rt/etc/RT_SiteConfig.pm if [[ -n "${RT_ROOT_PASSWORD}" ]]; then - (echo "${RT_ROOT_PASSWORD}" | /opt/rt%%RT_VERSION_MAJOR%%/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 + (echo "${RT_ROOT_PASSWORD}" | /opt/rt/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 fi exec "$@" diff --git a/master/Dockerfile b/master/Dockerfile new file mode 100644 index 0000000..1d42989 --- /dev/null +++ b/master/Dockerfile @@ -0,0 +1,49 @@ +#checkov:skip=CKV_DOCKER_2:Ensure that HEALTHCHECK instructions have been added to container images +#checkov:skip=CKV_DOCKER_3:Ensure that a user for the container has been created +ARG IMAGE=netsandbox/request-tracker-base +ARG TAG=latest +FROM ${IMAGE}:${TAG} + +LABEL org.opencontainers.image.authors="Christian Loos " + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +WORKDIR /usr/local/src + +# hadolint ignore=DL3003,SC2174 +RUN curl -fsSL -o rt.tar.gz https://github.com/bestpractical/rt/archive/refs/heads/master.tar.gz \ + && if [[ "https://github.com/bestpractical/rt/archive/refs/heads/master.tar.gz" =~ ^https://download.bestpractical.com/pub/rt/ ]]; then \ + curl -fsSL -o rt.tar.gz.asc https://github.com/bestpractical/rt/archive/refs/heads/master.tar.gz.asc; \ + gpg --keyserver keyserver.ubuntu.com --recv-keys C49B372F2BF84A19011660270DF0A283FEAC80B2; \ + gpg --list-keys; \ + gpg --verify rt.tar.gz.asc rt.tar.gz; \ + fi \ + && tar -xzf rt.tar.gz \ + && cd rt-* \ + && echo "rt-6.0.master.$(date -I)" > .tag \ + && ./configure.ac \ + --prefix=/opt/rt \ + --enable-developer \ + --enable-externalauth \ + --enable-gd \ + --enable-gpg \ + --enable-graphviz \ + --enable-smime \ + --with-db-type=SQLite \ + --with-web-handler=standalone \ + && RT_FIX_DEPS_CMD=cpanm make fixdeps && rm -rf /root/.cpanm \ + && make install \ + && mkdir --mode=0600 --parents /opt/rt/var/data/{gpg,smime} \ + && make initialize-database \ + && cd .. && rm -rf /usr/local/src/* + +WORKDIR /opt/rt +COPY RT_SiteConfig.pm etc/ + +VOLUME /opt/rt + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 80 +CMD ["/opt/rt/sbin/rt-server"] diff --git a/master/RT_SiteConfig.pm b/master/RT_SiteConfig.pm new file mode 100644 index 0000000..69e4209 --- /dev/null +++ b/master/RT_SiteConfig.pm @@ -0,0 +1,8 @@ +use utf8; + +Set($CanonicalizeRedirectURLs, RT_CANONICALIZE_REDIRECT_URLS); +Set($MailCommand, "RT_MAIL_COMMAND"); +Set($WebDomain, "RT_WEB_DOMAIN"); +Set($WebPort, RT_WEB_PORT); + +1; diff --git a/master/docker-entrypoint.sh b/master/docker-entrypoint.sh new file mode 100755 index 0000000..a7e9bfb --- /dev/null +++ b/master/docker-entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -euo pipefail + +: "${RT_CANONICALIZE_REDIRECT_URLS:=0}" +: "${RT_MAIL_COMMAND:=testfile}" +: "${RT_WEB_DOMAIN:=localhost}" +: "${RT_WEB_PORT:=80}" + +: "${RT_ROOT_PASSWORD:=}" + +sed -i \ + -e "s/RT_CANONICALIZE_REDIRECT_URLS/$RT_CANONICALIZE_REDIRECT_URLS/" \ + -e "s/RT_MAIL_COMMAND/$RT_MAIL_COMMAND/" \ + -e "s/RT_WEB_DOMAIN/$RT_WEB_DOMAIN/" \ + -e "s/RT_WEB_PORT/$RT_WEB_PORT/" \ + /opt/rt/etc/RT_SiteConfig.pm + +if [[ -n "${RT_ROOT_PASSWORD}" ]]; then + (echo "${RT_ROOT_PASSWORD}" | /opt/rt/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 +fi + +exec "$@" diff --git a/stable/Dockerfile b/stable/Dockerfile new file mode 100644 index 0000000..2a61c49 --- /dev/null +++ b/stable/Dockerfile @@ -0,0 +1,49 @@ +#checkov:skip=CKV_DOCKER_2:Ensure that HEALTHCHECK instructions have been added to container images +#checkov:skip=CKV_DOCKER_3:Ensure that a user for the container has been created +ARG IMAGE=netsandbox/request-tracker-base +ARG TAG=latest +FROM ${IMAGE}:${TAG} + +LABEL org.opencontainers.image.authors="Christian Loos " + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +WORKDIR /usr/local/src + +# hadolint ignore=DL3003,SC2174 +RUN curl -fsSL -o rt.tar.gz https://github.com/bestpractical/rt/archive/refs/heads/stable.tar.gz \ + && if [[ "https://github.com/bestpractical/rt/archive/refs/heads/stable.tar.gz" =~ ^https://download.bestpractical.com/pub/rt/ ]]; then \ + curl -fsSL -o rt.tar.gz.asc https://github.com/bestpractical/rt/archive/refs/heads/stable.tar.gz.asc; \ + gpg --keyserver keyserver.ubuntu.com --recv-keys C49B372F2BF84A19011660270DF0A283FEAC80B2; \ + gpg --list-keys; \ + gpg --verify rt.tar.gz.asc rt.tar.gz; \ + fi \ + && tar -xzf rt.tar.gz \ + && cd rt-* \ + && echo "rt-5.0.stable.$(date -I)" > .tag \ + && ./configure.ac \ + --prefix=/opt/rt \ + --enable-developer \ + --enable-externalauth \ + --enable-gd \ + --enable-gpg \ + --enable-graphviz \ + --enable-smime \ + --with-db-type=SQLite \ + --with-web-handler=standalone \ + && RT_FIX_DEPS_CMD=cpanm make fixdeps && rm -rf /root/.cpanm \ + && make install \ + && mkdir --mode=0600 --parents /opt/rt/var/data/{gpg,smime} \ + && make initialize-database \ + && cd .. && rm -rf /usr/local/src/* + +WORKDIR /opt/rt +COPY RT_SiteConfig.pm etc/ + +VOLUME /opt/rt + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 80 +CMD ["/opt/rt/sbin/rt-server"] diff --git a/stable/RT_SiteConfig.pm b/stable/RT_SiteConfig.pm new file mode 100644 index 0000000..69e4209 --- /dev/null +++ b/stable/RT_SiteConfig.pm @@ -0,0 +1,8 @@ +use utf8; + +Set($CanonicalizeRedirectURLs, RT_CANONICALIZE_REDIRECT_URLS); +Set($MailCommand, "RT_MAIL_COMMAND"); +Set($WebDomain, "RT_WEB_DOMAIN"); +Set($WebPort, RT_WEB_PORT); + +1; diff --git a/stable/docker-entrypoint.sh b/stable/docker-entrypoint.sh new file mode 100755 index 0000000..a7e9bfb --- /dev/null +++ b/stable/docker-entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -euo pipefail + +: "${RT_CANONICALIZE_REDIRECT_URLS:=0}" +: "${RT_MAIL_COMMAND:=testfile}" +: "${RT_WEB_DOMAIN:=localhost}" +: "${RT_WEB_PORT:=80}" + +: "${RT_ROOT_PASSWORD:=}" + +sed -i \ + -e "s/RT_CANONICALIZE_REDIRECT_URLS/$RT_CANONICALIZE_REDIRECT_URLS/" \ + -e "s/RT_MAIL_COMMAND/$RT_MAIL_COMMAND/" \ + -e "s/RT_WEB_DOMAIN/$RT_WEB_DOMAIN/" \ + -e "s/RT_WEB_PORT/$RT_WEB_PORT/" \ + /opt/rt/etc/RT_SiteConfig.pm + +if [[ -n "${RT_ROOT_PASSWORD}" ]]; then + (echo "${RT_ROOT_PASSWORD}" | /opt/rt/sbin/rt-passwd root) || [[ $? -gt 1 ]] && exit 1 +fi + +exec "$@" diff --git a/update.sh b/update.sh index 5d03689..3073126 100755 --- a/update.sh +++ b/update.sh @@ -2,25 +2,38 @@ set -Eeuo pipefail -declare -a versions=("4.4.7" "5.0.7") +declare -a versions=("4.4.7" "5.0.7" "stable" "master") for version in "${versions[@]}"; do - version_major_minor=${version%.*} + rt_dir=${version%.*} - mkdir -p "$version_major_minor" + mkdir -p "$rt_dir" - cp docker-entrypoint.sh RT_SiteConfig.pm "$version_major_minor" - cp Dockerfile.template "$version_major_minor"/Dockerfile + cp Dockerfile.template "${rt_dir}/Dockerfile" + cp docker-entrypoint.sh RT_SiteConfig.pm "$rt_dir" - if [[ "$version" == *"alpha"* ]] || [[ "$version" == *"beta"* ]]; then - release='devel' + if [[ "$version" =~ ^(master|stable)$ ]]; then + url="https://github.com/bestpractical/rt/archive/refs/heads/${version}.tar.gz" + + if [[ "$version" == "master" ]]; then + version_tag="rt-6.0.${version}" + else + version_tag="rt-5.0.${version}" + fi + + sed -i "s!%%RT_VERSION_TAG%%!$version_tag!" "${rt_dir}/Dockerfile" else - release='release' + if [[ "$version" =~ ^(alpha|beta)$ ]]; then + url="https://download.bestpractical.com/pub/rt/devel/rt-${version}.tar.gz" + else + url="https://download.bestpractical.com/pub/rt/release/rt-${version}.tar.gz" + fi + + sed -i \ + -e "/%%RT_VERSION_TAG%%/d" \ + -e "/make fixdeps/d" \ + "${rt_dir}/Dockerfile" fi - sed -i \ - -e "s/%%RT_RELEASE%%/$release/" \ - -e "s/%%RT_VERSION_MAJOR%%/${version%%.*}/" \ - -e "s/%%RT_VERSION%%/$version/" \ - "$version_major_minor"/docker-entrypoint.sh "$version_major_minor"/Dockerfile + sed -i "s!%%RT_URL%%!$url!" "${rt_dir}/Dockerfile" done