diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..23bf406 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# Build Docker image for Amd64 +FROM node:19-bullseye-slim + +# Add metadata about the image +LABEL maintainer="Göran Sander mountaindude@ptarmiganlabs.com" +LABEL description="Extract data lineage, load scripts and data connections from Qlik Sense." + +# Create app dir inside container +WORKDIR /nodeapp + +# Install app dependencies separately (creating a separate layer for node_modules, effectively caching them between image rebuilds) +COPY package.json . +RUN npm install + +# Copy app's source files +COPY . . + +# Create and use non-root user +RUN groupadd -r nodejs \ + && useradd -m -r -g nodejs nodejs + +USER nodejs + +# Set up Docker healthcheck +HEALTHCHECK --interval=12s --timeout=12s --start-period=30s CMD ["node", "docker-healthcheck.js"] + +CMD ["node", "butler-spyglass.js"] + diff --git a/changelog.md b/changelog.md index c34240c..52ba3ac 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,18 @@ # Changelog +## [2.0.2](https://github.com/ptarmiganlabs/butler-spyglass/compare/butler-spyglass-v2.0.1...butler-spyglass-v2.0.2) (2023-03-12) + + +### Documentation + +* Add status badge to readme file ([f060f9a](https://github.com/ptarmiganlabs/butler-spyglass/commit/f060f9a4a71a8e6be4eec67fcaef9c8b39ea1337)) +* Re-written most of docs wrt 2.x release ([1d7cb6d](https://github.com/ptarmiganlabs/butler-spyglass/commit/1d7cb6d353c6fc8ebc7a47d05c0e63080a094ef3)) + + +### Build pipeline + +* Disable MQTT messages from Docker build workflow ([f6b1712](https://github.com/ptarmiganlabs/butler-spyglass/commit/f6b17123b08e1566c20c2149add37fa2fe4954a8)) + ## [2.0.1](https://github.com/ptarmiganlabs/butler-spyglass/compare/butler-spyglass-v2.0.0...butler-spyglass-v2.0.1) (2023-03-10) diff --git a/docker-healthcheck.js b/docker-healthcheck.js new file mode 100644 index 0000000..f67cbed --- /dev/null +++ b/docker-healthcheck.js @@ -0,0 +1,27 @@ +/* eslint-disable no-console */ +// Set up REST endpoint for Docker healthchecks +const httpHealth = require('http'); + +const optionsHealth = { + host: 'localhost', + port: '12398', + path: '/health', + timeout: 2000, +}; + +const requestHealth = httpHealth.request(optionsHealth, (res) => { + console.log(`STATUS Docker health: ${res.statusCode}`); + if (res.statusCode === 200) { + process.exit(0); + } else { + process.exit(1); + } +}); + +requestHealth.on('error', (err) => { + console.log('ERROR Docker health:'); + console.log(err); + process.exit(1); +}); + +requestHealth.end();