Skip to content

Commit

Permalink
Update to Node18 (#1337)
Browse files Browse the repository at this point in the history
* Update to Node18

* use Jammy builder

* Remove python2

* Fix npm ci

* use Focal
  • Loading branch information
carrolp committed Sep 14, 2023
1 parent 33f4fd0 commit dae46dd
Show file tree
Hide file tree
Showing 4 changed files with 753 additions and 14,908 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
dist: focal
node_js:
- 16
- 18

services:
- docker
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
#######################################
# Build the preliminary image
#######################################
FROM node:12-alpine as buildImg
FROM node:18-alpine as buildImg

RUN apk update
RUN apk --no-cache add python2 make g++
RUN apk --no-cache add python3 make g++

USER node
WORKDIR /home/node

COPY --chown=node . /home/node
RUN npm install --production --loglevel=warn
RUN npm ci --legacy-peer-deps --omit=dev --loglevel=warn


#######################################
# Build the production image
#######################################
FROM node:12-alpine
FROM node:18-alpine

USER node
WORKDIR /home/node
Expand All @@ -45,4 +45,5 @@ ENV BUILD_ID=${BUILD_ID}
COPY --chown=node --from=buildImg /home/node /home/node

EXPOSE 3333
ENV NODE_OPTIONS="--dns-result-order=ipv4first"
CMD ["npm", "start"]
4 changes: 4 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const {router, initialize} = require('./routes/index.js');
const log = require('./log').createLogger('razeedash-api/app/index');
const port = 3333;

// Set ipv4first (changed in Node 18)
const dns = require('dns');
dns.setDefaultResultOrder('ipv4first');

const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.json');
if(process.env.EXTERNAL_HOST){
Expand Down

0 comments on commit dae46dd

Please sign in to comment.