Skip to content

Commit

Permalink
Allow more verbose messages from container builds. (#24)
Browse files Browse the repository at this point in the history
Make `npm install` show more debugging information, use more repository variables.
  • Loading branch information
mmunro-ltrr authored Oct 7, 2024
1 parent 965105f commit 4a1ec40
Show file tree
Hide file tree
Showing 5 changed files with 610 additions and 626 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
version:
description: The version to tag and release
required: true
env:
AZ_EPHEMERALIMAGENAME: ${{ vars.AZ_EPHEMERALIMAGENAME }}

jobs:
release:
Expand All @@ -23,8 +25,7 @@ jobs:
run: |
oldhash=${{ hashFiles('Dockerfile', 'package.json', 'package-lock.json', 'scripts/*') }}
imageprefix=${{ vars.AZ_DOCKER_REGISTRY }}"/${GITHUB_REPOSITORY}/"
imagename='az-nodejs-ephemeral'
imagestem="${imageprefix}${imagename}:"
imagestem="${imageprefix}${AZ_EPHEMERALIMAGENAME}:"
echo "AZ_OLD_HASH=${oldhash}" >> ${GITHUB_ENV}
echo "AZ_IMAGE_STEM=${imagestem}" >> ${GITHUB_ENV}
echo "AZ_BOOTSTRAP_SOURCE_DIR=/arizona-bootstrap-source" >> ${GITHUB_ENV}
Expand All @@ -42,7 +43,8 @@ jobs:

- name: Unconditionally rebuild and save the Docker image
run: |
workingtitle=$(docker build -q . )
workingtitle="${AZ_EPHEMERALIMAGENAME}:working"
docker build --no-cache -t "$workingtitle" --build-arg AZ_BOOTSTRAP_FROZEN_DIR . \
tempname="old${AZ_OLD_HASH}"
docker run --name "$tempname" "$workingtitle" true
docker cp -a "${tempname}:${AZ_BOOTSTRAP_FROZEN_DIR}/." .
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/review-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 2.x
env:
AZ_SITE_HOST: ${{ vars.AZ_SITE_HOST }}
AZ_EPHEMERALIMAGENAME: ${{ vars.AZ_EPHEMERALIMAGENAME }}
permissions: write-all
jobs:
lint-code:
Expand All @@ -23,8 +24,7 @@ jobs:
run: |
oldhash=${{ hashFiles('Dockerfile', 'package.json', 'package-lock.json', 'scripts/*') }}
imageprefix=${{ vars.AZ_DOCKER_REGISTRY }}"/${GITHUB_REPOSITORY}/"
imagename='az-nodejs-ephemeral'
imagestem="${imageprefix}${imagename}:"
imagestem="${imageprefix}${AZ_EPHEMERALIMAGENAME}:"
echo "AZ_OLD_HASH=${oldhash}" >> ${GITHUB_ENV}
echo "AZ_IMAGE_STEM=${imagestem}" >> ${GITHUB_ENV}
echo "AZ_EPHEMERAL_IMAGE=${imagestem}${oldhash}" >> ${GITHUB_ENV}
Expand All @@ -46,7 +46,8 @@ jobs:
- name: Conditionally rebuild and save the Docker image
if: ${{ steps.dockerpull.outcome == 'failure' }}
run: |
workingtitle=$(docker build -q . )
workingtitle="${AZ_EPHEMERALIMAGENAME}:working"
docker build --no-cache -t "$workingtitle" --build-arg AZ_BOOTSTRAP_FROZEN_DIR .
tempname="old${AZ_OLD_HASH}"
docker run --name "$tempname" "$workingtitle" true
docker cp -a "${tempname}:${AZ_BOOTSTRAP_FROZEN_DIR}/." .
Expand Down Expand Up @@ -82,8 +83,7 @@ jobs:
run: |
oldhash=${{ hashFiles('Dockerfile', 'package.json', 'package-lock.json', 'scripts/*') }}
imageprefix=${{ vars.AZ_DOCKER_REGISTRY }}"/${GITHUB_REPOSITORY}/"
imagename='az-nodejs-ephemeral'
imagestem="${imageprefix}${imagename}:"
imagestem="${imageprefix}${AZ_EPHEMERALIMAGENAME}:"
echo "AZ_OLD_HASH=${oldhash}" >> ${GITHUB_ENV}
echo "AZ_IMAGE_STEM=${imagestem}" >> ${GITHUB_ENV}
echo "AZ_EPHEMERAL_IMAGE=${imagestem}${oldhash}" >> ${GITHUB_ENV}
Expand All @@ -105,7 +105,8 @@ jobs:
- name: Conditionally rebuild and save the Docker image
if: ${{ steps.dockerpull.outcome == 'failure' }}
run: |
workingtitle=$(docker build -q . )
workingtitle="${AZ_EPHEMERALIMAGENAME}:working"
docker build --no-cache -t "$workingtitle" --build-arg AZ_BOOTSTRAP_FROZEN_DIR .
tempname="old${AZ_OLD_HASH}"
docker run --name "$tempname" "$workingtitle" true
docker cp -a "${tempname}:${AZ_BOOTSTRAP_FROZEN_DIR}/." .
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ WORKDIR $AZ_BOOTSTRAP_FROZEN_DIR
RUN mkdir /home/node/.npm \
&& chown node:node /home/node/.npm
RUN npm config set cache='/home/node/.npm' \
&& npm install
&& npm install --foreground-scripts=true --loglevel=verbose
RUN find node_modules -name '.DS_Store' -exec rm {} \; \
&& chown -R node:node "$AZ_BOOTSTRAP_FROZEN_DIR"

Expand Down
Loading

0 comments on commit 4a1ec40

Please sign in to comment.