Implement use of package.json 'version' etc. for '$ docker build …'

This commit is contained in:
Wolfgang Huß 2021-05-11 16:03:41 +02:00
parent 682a7c3c5c
commit 0344a1b4cc
3 changed files with 15 additions and 5 deletions

View File

@ -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:

View File

@ -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/

View File

@ -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",