From 0344a1b4cc3ba1d2d9c49e3bee7dcc4ea63c9107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 11 May 2021 16:03:41 +0200 Subject: [PATCH] =?UTF-8?q?Implement=20use=20of=20package.json=20'version'?= =?UTF-8?q?=20etc.=20for=20'$=20docker=20build=20=E2=80=A6'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 12 +++++++++--- docker/webapp.Dockerfile | 3 ++- package.json | 5 ++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3a28d0c..fe37236 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -61,10 +61,16 @@ jobs: ########################################################################## - name: ENV - VERSION run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + - name: ENV - BUILD_NUMBER + run: echo "BUILD_NUMBER=$(node -p -e "require('./package.json').build-number")" >> $GITHUB_ENV + - name: ENV - DOCKER_ORGANISATION_SOURCE + run: echo "DOCKER_ORGANISATION_SOURCE=$(node -p -e "require('./package.json').docker-organisation-source")" >> $GITHUB_ENV + - name: ENV - DOCKER_ORGANISATION_PUSH + run: echo "DOCKER_ORGANISATION_PUSH=$(node -p -e "require('./package.json').docker-organisation-push")" >> $GITHUB_ENV - name: ENV - BUILD_DATE run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + run: echo "BUILD_VERSION=${VERSION}-${BUILD_NUMBER}" >> $GITHUB_ENV - name: ENV - BUILD_COMMIT run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV ########################################################################## @@ -72,8 +78,8 @@ jobs: ########################################################################## - name: webapp | Build `branded` image run: | - docker build --target branded -t "ocelotsocialnetwork/webapp-branded:latest" -t "ocelotsocialnetwork/webapp-branded:${VERSION}" -t "ocelotsocialnetwork/webapp-branded:${BUILD_VERSION}" -f docker/webapp.Dockerfile . - docker save "ocelotsocialnetwork/webapp-branded" > /tmp/webapp-branded.tar + docker build --target branded -t "${DOCKER_ORGANISATION_PUSH}/webapp-branded:latest" -t "${DOCKER_ORGANISATION_PUSH}/webapp-branded:${VERSION}" -t "${DOCKER_ORGANISATION_PUSH}/webapp-branded:${BUILD_VERSION}" -f docker/webapp.Dockerfile --build-arg APP_IMAGE=${DOCKER_ORGANISATION_SOURCE}/webapp:${BUILD_VERSION} . + docker save "${DOCKER_ORGANISATION_PUSH}/webapp-branded" > /tmp/webapp-branded.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: diff --git a/docker/webapp.Dockerfile b/docker/webapp.Dockerfile index cec47cc..58516f3 100644 --- a/docker/webapp.Dockerfile +++ b/docker/webapp.Dockerfile @@ -1,7 +1,8 @@ ################################################################################## # BRANDED ######################################################################## ################################################################################## -FROM ocelotsocialnetwork/webapp:latest as branded +ARG APP_IMAGE=ocelotsocialnetwork/webapp:latest +FROM $APP_IMAGE as branded # Copy public constants to the docker image branding it COPY branding/static/ static/ diff --git a/package.json b/package.json index adb67e8..b483e1f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "name": "ocelot-social-branded", - "version": "0.0.6", + "version": "1.0.2", + "build-number": "79", + "docker-organisation-source": "ocelotsocialnetwork", + "docker-organisation-push": "ocelotsocialnetwork", "description": "Ocelot Social Branded", "author": "ocelot.social Community", "license": "MIT",