docker image labels
This commit is contained in:
12
.github/workflows/build_docker_image.yml
vendored
12
.github/workflows/build_docker_image.yml
vendored
@@ -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
|
||||||
|
15
Dockerfile
15
Dockerfile
@@ -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
|
||||||
|
|
||||||
|
@@ -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.');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user