diff --git a/package.json b/package.json index a50086f6fd..78b5249155 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "jest-runner": "27.5.1", "nock": "13.2.4", "npm-run-all": "4.1.5", - "playwright": "1.19.2", + "playwright": "1.20.2", "prettier": "2.5.1", "pretty-quick": "3.1.3", "redis-commands": "1.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe4aaecf1e..4c40f4e7fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,7 +68,7 @@ importers: pino-elasticsearch: 6.2.0 pino-http: 6.6.0 pino-pretty: 7.5.3 - playwright: 1.19.2 + playwright: 1.20.2 prettier: 2.5.1 pretty-quick: 3.1.3 redis-commands: 1.7.0 @@ -143,7 +143,7 @@ importers: jest-runner: 27.5.1 nock: 13.2.4 npm-run-all: 4.1.5 - playwright: 1.19.2 + playwright: 1.20.2 prettier: 2.5.1 pretty-quick: 3.1.3_prettier@2.5.1 redis-commands: 1.7.0 @@ -7635,8 +7635,6 @@ packages: resolution: {integrity: sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==} engines: {node: '>=0.1.90'} requiresBuild: true - dev: false - optional: true /combine-promises/1.1.0: resolution: {integrity: sha512-ZI9jvcLDxqwaXEixOhArm3r7ReIivsXkpbyEWyeOhzz1QS0iSgBPnWvEqvIQtYyamGCYA88gFhmUrs9hrrQ0pg==} @@ -13477,7 +13475,7 @@ packages: array-differ: 3.0.0 array-union: 2.1.0 arrify: 2.0.1 - minimatch: 3.0.4 + minimatch: 3.1.2 dev: true /mute-stream/0.0.8: @@ -14553,6 +14551,13 @@ packages: resolution: {integrity: sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==} engines: {node: '>= 6'} + /pixelmatch/5.2.1: + resolution: {integrity: sha512-WjcAdYSnKrrdDdqTcVEY7aB7UhhwjYQKYhHiBXdJef0MOaQeYpUdQ+iVyBLa5YBKS8MPVPPMX7rpOByISLpeEQ==} + hasBin: true + dependencies: + pngjs: 4.0.1 + dev: true + /pkg-dir/4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} @@ -14593,17 +14598,19 @@ packages: - utf-8-validate dev: true - /playwright-core/1.19.2: - resolution: {integrity: sha512-OsL3sJZIo1UxKNWSP7zW7sk3FyUGG06YRHxHeBw51eIOxTCQRx5t+hXd0cvXashN2CHnd3hIZTs2aKa/im4hZQ==} + /playwright-core/1.20.2: + resolution: {integrity: sha512-iV6+HftSPalynkq0CYJala1vaTOq7+gU9BRfKCdM9bAxNq/lFLrwbluug2Wt5OoUwbMABcnTThIEm3/qUhCdJQ==} engines: {node: '>=12'} hasBin: true dependencies: + colors: 1.4.0 commander: 8.3.0 debug: 4.3.3 extract-zip: 2.0.1 https-proxy-agent: 5.0.0 jpeg-js: 0.4.3 mime: 3.0.0 + pixelmatch: 5.2.1 pngjs: 6.0.0 progress: 2.0.3 proper-lockfile: 4.1.2 @@ -14620,13 +14627,13 @@ packages: - utf-8-validate dev: true - /playwright/1.19.2: - resolution: {integrity: sha512-2JmGWr/Iw/Uu27bZULeHgjn8doNrRVxIYdhspMuMlfKNpzwAe/sfm7wH8uey6jiZxnPL4bC5V4ACQcF4dAGWnw==} + /playwright/1.20.2: + resolution: {integrity: sha512-p6GE8A/f2G7t8FIk/AwQ94nT7R7tyPRJyKt1FwRjwBDf4WdpgoAr4hDfMgHy+CkClR22adFjopGwhxXAPsewhg==} engines: {node: '>=12'} hasBin: true requiresBuild: true dependencies: - playwright-core: 1.19.2 + playwright-core: 1.20.2 transitivePeerDependencies: - bufferutil - supports-color @@ -14724,6 +14731,11 @@ packages: - utf-8-validate dev: false + /pngjs/4.0.1: + resolution: {integrity: sha512-rf5+2/ioHeQxR6IxuYNYGFytUyG3lma/WW1nsmjeHlWwtb2aByla6dkVc8pmJ9nplzkTA0q2xx7mMWrOTqT4Gg==} + engines: {node: '>=8.0.0'} + dev: true + /pngjs/5.0.0: resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==} engines: {node: '>=10.13.0'} diff --git a/src/api/sso/.dockerignore b/src/api/sso/.dockerignore index b5d1637224..b0ed6708a8 100644 --- a/src/api/sso/.dockerignore +++ b/src/api/sso/.dockerignore @@ -4,3 +4,6 @@ npm-debug.log Dockerfile .git .gitignore +jest* +.env* +test/ diff --git a/src/api/sso/Dockerfile b/src/api/sso/Dockerfile index 2711a7cfc3..d466e290c2 100644 --- a/src/api/sso/Dockerfile +++ b/src/api/sso/Dockerfile @@ -1,46 +1,45 @@ -## Base ######################################################################## +## Base ########################################################################### +# Set up the base layer # Use a larger node image to do the build for native deps (e.g., gcc, pytyhon) -FROM node:lts as base +FROM node:16 as base # Reduce npm log spam and colour during install within Docker ENV NPM_CONFIG_LOGLEVEL=warn ENV NPM_CONFIG_COLOR=false -# We'll run the app as the `node` user, so put it in their home directory -WORKDIR /home/node/app -# Copy the package.json and lock file over -COPY package*.json /home/node/app/ - -## Development ################################################################# -# Define a development target that installs devDeps and runs in dev mode -FROM base as development -WORKDIR /home/node/app -# Install (not ci) with dependencies, and for Linux vs. Linux Musl (which we use for -alpine) -RUN npm install -# Copy the source code over -COPY --chown=node:node . /home/node/app/ -# Switch to the node user vs. root -USER node -# Start the app in debug mode so we can attach the debugger -CMD ["npm", "run", "dev"] +RUN npm i -g pnpm + +WORKDIR /app -## Production ################################################################## -# Also define a production target which doesn't use devDeps -FROM base as production -WORKDIR /home/node/app -# We'll install production only deps -RUN npm install --production +## Dependencies ################################################################### +# Stage for installing prod dependencies +FROM base as dependencies + +COPY package.json ./ + +RUN pnpm install --prod ## Deploy ###################################################################### +# Stage for that run our app # Use a smaller node image (-alpine) at runtime -FROM node:lts-alpine as deploy +FROM node:16-alpine3.15 as deploy + +WORKDIR /app + +# Copy prodduction node_modules from dependencies +COPY --chown=node:node --from=dependencies /app/node_modules ./node_modules/ -WORKDIR /home/node/app -# Copy what we've installed/built from production -COPY --chown=node:node --from=production /home/node/app/node_modules /home/node/app/node_modules/ # Copy the source code -COPY --chown=node:node . /home/node/app/ +COPY --chown=node:node . . + # Switch to the node user vs. root USER node + +ENV SSO_PORT=7777 + +# Docker Healthcheck +HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider localhost:${SSO_PORT}/healthcheck || exit 1 + # Start the app CMD ["node", "src/server.js"]