diff --git a/Dockerfile b/Dockerfile index 414b1a18e..2a6a67713 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # # Builder # -FROM node:14-alpine3.17 AS builder +FROM node:20-alpine3.17 as builder WORKDIR /opt/azurite @@ -11,16 +11,14 @@ COPY *.json LICENSE NOTICE.txt ./ # Copy the source code and build the app COPY src ./src COPY tests ./tests -RUN npm config set unsafe-perm=true && \ - npm ci +RUN npm ci --unsafe-perm RUN npm run build && \ - npm install -g --loglevel verbose + npm install -g --unsafe-perm --loglevel verbose -# # Production image # -FROM node:14-alpine3.17 +FROM node:20-alpine3.17 ENV NODE_ENV=production @@ -33,8 +31,11 @@ COPY package*.json LICENSE NOTICE.txt ./ COPY --from=builder /opt/azurite/dist/ dist/ -RUN npm config set unsafe-perm=true && \ - npm install -g --loglevel verbose +RUN npm pkg set scripts.prepare="echo no-prepare" + +RUN npm ci --unsafe-perm + +RUN npm install -g --unsafe-perm --loglevel verbose # Blob Storage Port EXPOSE 10000 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 92fdcc4ad..26ed48da7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -571,8 +571,8 @@ jobs: # our .exe build program is currently incompatible with node 10 # node_10_x: # node_version: 10.x - node_14_x: - node_version: 14.x + node_18_x: + node_version: 18.x steps: - task: NodeTool@0 inputs: diff --git a/scripts/buildExe.js b/scripts/buildExe.js index 57b49a05d..851cf7b48 100644 --- a/scripts/buildExe.js +++ b/scripts/buildExe.js @@ -12,13 +12,13 @@ const pkgFetch = require('pkg-fetch'); build(); async function build() { - const pkgTarget = 'node14-win-x64'; + const pkgTarget = 'node18-win-x64'; const cacheExe = await downloadCache(pkgTarget); await rcedit(cacheExe, { "version-string": { - "CompanyName": "Microsoft", - "ProductName": "Azurite", - "FileDescription": "Azurite", + "CompanyName": "Microsoft", + "ProductName": "Azurite", + "FileDescription": "Azurite", "ProductVersion": pjson.version, "OriginalFilename": "", "InternalName": "node", @@ -27,7 +27,7 @@ async function build() { // file-version is kept as the node version used by the .exe for debugging purposes "icon": path.resolve('.\\icon.ico') }); - + // rename the cache file to skip hash check by pkg-fetch since hash check reverts our change of properties const newName = cacheExe.replace("fetched", "built"); @@ -38,14 +38,14 @@ async function build() { } await asyncRename(cacheExe, newName); - + const outputExe = path.resolve('.\\release\\azurite.exe'); await pkg.exec([path.resolve('.'), ...['--target', pkgTarget], ...['--output', outputExe], ...['-C', 'Brotli']]); } async function downloadCache(pkgTarget) { const [nodeRange, platform, arch] = pkgTarget.split('-'); - + await pkgFetch.need({ nodeRange, platform, arch }); const cacheExe = glob.sync(process.env.PKG_CACHE_PATH + "\\**\\fetched*"); if (cacheExe.length < 1) {