From 356bacf9a0cd230b845d289232a75413a4e3106f Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Tue, 9 Apr 2024 12:53:13 +0100 Subject: [PATCH] Update Dockerfile.tpl files to set APP_VERSION to 2.0.0 if not set --- Accounts/Dockerfile.tpl | 14 ++++++++++++-- AdminDashboard/Dockerfile.tpl | 14 ++++++++++++-- App/Dockerfile.tpl | 13 ++++++++++++- Dashboard/Dockerfile.tpl | 14 ++++++++++++-- Haraka/Dockerfile.tpl | 4 ++++ InfrastructureAgent/Dockerfile.tpl | 11 ++++++++++- Ingestor/Dockerfile.tpl | 11 ++++++++++- IsolatedVM/Dockerfile.tpl | 11 ++++++++++- Nginx/Dockerfile.tpl | 11 ++++++++++- Probe/Dockerfile.tpl | 11 ++++++++++- StatusPage/Dockerfile.tpl | 14 ++++++++++++-- TestServer/Dockerfile.tpl | 11 ++++++++++- Tests/Dockerfile.tpl | 4 ++++ 13 files changed, 128 insertions(+), 15 deletions(-) diff --git a/Accounts/Dockerfile.tpl b/Accounts/Dockerfile.tpl index ef2e2a7b5e..7c51a1d5aa 100644 --- a/Accounts/Dockerfile.tpl +++ b/Accounts/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -25,6 +29,8 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common @@ -32,13 +38,16 @@ COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer @@ -48,7 +57,8 @@ COPY ./CommonServer /usr/src/CommonServer # Install CommonUI WORKDIR /usr/src/CommonUI -COPY ./CommonUI/package*.json /usr/src/CommonUI/ +# Set version in ./CommonUI/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonUI/package.json RUN npm install --force COPY ./CommonUI /usr/src/CommonUI diff --git a/AdminDashboard/Dockerfile.tpl b/AdminDashboard/Dockerfile.tpl index b167052695..1265a62f76 100644 --- a/AdminDashboard/Dockerfile.tpl +++ b/AdminDashboard/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -25,19 +29,24 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer @@ -47,7 +56,8 @@ COPY ./CommonServer /usr/src/CommonServer # Install CommonUI WORKDIR /usr/src/CommonUI -COPY ./CommonUI/package*.json /usr/src/CommonUI/ +# Set version in ./CommonUI/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonUI/package.json RUN npm install --force COPY ./CommonUI /usr/src/CommonUI diff --git a/App/Dockerfile.tpl b/App/Dockerfile.tpl index 1ccb6606f0..47ac919245 100644 --- a/App/Dockerfile.tpl +++ b/App/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -29,19 +33,24 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer @@ -53,6 +62,8 @@ WORKDIR /usr/src/app # Install app dependencies COPY ./App/package*.json /usr/src/app/ +# Set version in ./App/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/app/package.json RUN npm install # Expose ports. diff --git a/Dashboard/Dockerfile.tpl b/Dashboard/Dockerfile.tpl index d90a5351b1..eec14dd614 100644 --- a/Dashboard/Dockerfile.tpl +++ b/Dashboard/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -25,19 +29,24 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer @@ -47,7 +56,8 @@ COPY ./CommonServer /usr/src/CommonServer # Install CommonUI WORKDIR /usr/src/CommonUI -COPY ./CommonUI/package*.json /usr/src/CommonUI/ +# Set version in ./CommonUI/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonUI/package.json RUN npm install --force COPY ./CommonUI /usr/src/CommonUI diff --git a/Haraka/Dockerfile.tpl b/Haraka/Dockerfile.tpl index c5faae1d30..dccf04d1ac 100644 --- a/Haraka/Dockerfile.tpl +++ b/Haraka/Dockerfile.tpl @@ -9,6 +9,10 @@ ARG APP_VERSION ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} + +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + RUN apk add bash # install dependence diff --git a/InfrastructureAgent/Dockerfile.tpl b/InfrastructureAgent/Dockerfile.tpl index 2491a054e6..285a61b301 100644 --- a/InfrastructureAgent/Dockerfile.tpl +++ b/InfrastructureAgent/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -29,18 +33,23 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer diff --git a/Ingestor/Dockerfile.tpl b/Ingestor/Dockerfile.tpl index 0f9b233715..c5b21846d1 100644 --- a/Ingestor/Dockerfile.tpl +++ b/Ingestor/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -29,19 +33,24 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer diff --git a/IsolatedVM/Dockerfile.tpl b/IsolatedVM/Dockerfile.tpl index ddbbcd2d26..005b03eede 100644 --- a/IsolatedVM/Dockerfile.tpl +++ b/IsolatedVM/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -29,19 +33,24 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer diff --git a/Nginx/Dockerfile.tpl b/Nginx/Dockerfile.tpl index 02e6be69eb..6afa100896 100644 --- a/Nginx/Dockerfile.tpl +++ b/Nginx/Dockerfile.tpl @@ -7,6 +7,10 @@ ARG APP_VERSION ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} + +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + # Install bash. RUN apk add bash && apk add curl && apk add openssl @@ -28,18 +32,23 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer diff --git a/Probe/Dockerfile.tpl b/Probe/Dockerfile.tpl index 24a7f623c4..40c982aa58 100644 --- a/Probe/Dockerfile.tpl +++ b/Probe/Dockerfile.tpl @@ -13,6 +13,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -31,19 +35,24 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer diff --git a/StatusPage/Dockerfile.tpl b/StatusPage/Dockerfile.tpl index 8b83820d6a..31a9f7c5bf 100644 --- a/StatusPage/Dockerfile.tpl +++ b/StatusPage/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -26,19 +30,24 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer @@ -46,7 +55,8 @@ COPY ./CommonServer /usr/src/CommonServer # Install CommonUI WORKDIR /usr/src/CommonUI -COPY ./CommonUI/package*.json /usr/src/CommonUI/ +# Set version in ./CommonUI/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonUI/package.json RUN npm install --force COPY ./CommonUI /usr/src/CommonUI diff --git a/TestServer/Dockerfile.tpl b/TestServer/Dockerfile.tpl index ed08c502df..c89148b832 100644 --- a/TestServer/Dockerfile.tpl +++ b/TestServer/Dockerfile.tpl @@ -14,6 +14,10 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + + # Install bash. RUN apk add bash && apk add curl @@ -29,19 +33,24 @@ RUN mkdir /usr/src WORKDIR /usr/src/Common COPY ./Common/package*.json /usr/src/Common/ +# Set version in ./Common/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json RUN npm install COPY ./Common /usr/src/Common WORKDIR /usr/src/Model COPY ./Model/package*.json /usr/src/Model/ +# Set version in ./Model/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Model/package.json RUN npm install COPY ./Model /usr/src/Model WORKDIR /usr/src/CommonServer -COPY ./CommonServer/package*.json /usr/src/CommonServer/ +# Set version in ./CommonServer/package.json to the APP_VERSION +RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/CommonServer/package.json RUN npm install COPY ./CommonServer /usr/src/CommonServer diff --git a/Tests/Dockerfile.tpl b/Tests/Dockerfile.tpl index 1d4e899f87..dc5922f029 100644 --- a/Tests/Dockerfile.tpl +++ b/Tests/Dockerfile.tpl @@ -11,6 +11,10 @@ ARG APP_VERSION ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} + +# IF APP_VERSION is not set, set it to 1.0.0 +RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=2.0.0; fi + RUN apk add bash COPY ./Tests .