docker image labels
All checks were successful
App Image CI / Build app image (push) Successful in 19s
NPM Audit Check / Check NPM audit (push) Successful in -2m9s

This commit is contained in:
2025-10-14 01:33:49 -05:00
parent dedc73cf8c
commit 7f66b8510d
3 changed files with 28 additions and 1 deletions

View File

@@ -54,6 +54,18 @@ jobs:
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Define metadata variables
run: |
sed -i "s/ARG githash=.*/ARG githash=${{ github.sha }}/" Dockerfile
sed -i "s/ARG created=.*/ARG created=$(date -u +'%Y-%m-%dT%H:%M:%S%:z')/" Dockerfile
cat Dockerfile
- name: Define metadata variables
if: startsWith(github.ref, 'refs/tags/v')
run: |
sed -i "s/ARG version=.*/ARG version=${{ github.ref_name }}/" Dockerfile
cat Dockerfile
- name: Extract metadata for release Docker image - name: Extract metadata for release Docker image
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
id: meta id: meta

View File

@@ -19,6 +19,21 @@ RUN npx tsc && npm run-script build && \
FROM base AS deploy FROM base AS deploy
ARG version=develop
ARG githash=REVISION
ARG created=CREATED
LABEL org.opencontainers.image.title="nodejs-web-template"
LABEL org.opencontainers.image.description="Template for my nodejs web projects"
LABEL org.opencontainers.image.authors="Cory Sanin <corysanin@outlook.com>"
LABEL org.opencontainers.image.url="https://git.sanin.dev/corysanin/nodejs-web-template"
LABEL org.opencontainers.image.documentation="https://git.sanin.dev/corysanin/nodejs-web-template"
LABEL org.opencontainers.image.source="https://git.sanin.dev/corysanin/nodejs-web-template"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.version="${version}"
LABEL org.opencontainers.image.revision="${githash}"
LABEL org.opencontainers.image.created="${created}"
HEALTHCHECK --timeout=3s \ HEALTHCHECK --timeout=3s \
CMD curl --fail http://localhost:8080/healthcheck || exit 1 CMD curl --fail http://localhost:8080/healthcheck || exit 1

View File

@@ -35,7 +35,7 @@ class Web {
const sessionSecret = process.env['SESSIONSECRET'] || options.sessionSecret; const sessionSecret = process.env['SESSIONSECRET'] || options.sessionSecret;
const app: Express = this.app = express(); const app: Express = this.app = express();
if(!sessionSecret) { if (!sessionSecret) {
console.error('sessionSecret is required.'); console.error('sessionSecret is required.');
throw new Error('sessionSecret is required.'); throw new Error('sessionSecret is required.');
} }