chore: update to node 18 and alpine 3.17 (#2430)

* chore: update to node 18 and alpine 3.17

Signed-off-by: martin <martin.labat92@gmail.com>

* chore: fix sharp version

Signed-off-by: martin <martin.labat92@gmail.com>

* chore(server): use vips-dev

Signed-off-by: martin <martin.labat92@gmail.com>

* update checkDiskUsage

Signed-off-by: martin <martin.labat92@gmail.com>

* fix: use vips-heif instead of libheif

Signed-off-by: martin <martin.labat92@gmail.com>

* fix: use vips instead of vips-cpp

Signed-off-by: martin <martin.labat92@gmail.com>

* fix: ensure vips installation

Signed-off-by: martin <martin.labat92@gmail.com>

---------

Signed-off-by: martin <martin.labat92@gmail.com>
This commit is contained in:
martin 2023-05-18 17:56:33 +02:00 committed by GitHub
parent c7c0ef6abc
commit 70a0f4ae48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5100 additions and 4672 deletions

View file

@ -1,8 +1,8 @@
FROM node:16-alpine3.14 as builder
FROM node:18-alpine3.17 as builder
WORKDIR /usr/src/app
RUN apk add --update-cache build-base python3 libheif vips-dev ffmpeg perl
RUN apk add --update-cache build-base python3 vips-heif vips-dev ffmpeg perl
COPY package.json package-lock.json ./
@ -17,13 +17,13 @@ RUN npm run build
RUN npm prune --omit=dev --omit=optional
FROM node:16-alpine3.14
FROM node:18-alpine3.17
ENV NODE_ENV=production
WORKDIR /usr/src/app
RUN apk add --no-cache libheif vips ffmpeg perl
RUN apk add --no-cache vips-heif vips vips-cpp ffmpeg perl
COPY --from=prod /usr/src/app/node_modules ./node_modules
COPY --from=prod /usr/src/app/dist ./dist

View file

@ -3,7 +3,6 @@ import { constants, createReadStream, existsSync, mkdirSync } from 'fs';
import fs from 'fs/promises';
import mv from 'mv';
import { promisify } from 'node:util';
import diskUsage from 'diskusage';
import path from 'path';
const moveFile = promisify<string, string, mv.Options>(mv);
@ -68,7 +67,12 @@ export class FilesystemProvider implements IStorageRepository {
}
}
checkDiskUsage(folder: string): Promise<DiskUsage> {
return diskUsage.check(folder);
async checkDiskUsage(folder: string): Promise<DiskUsage> {
const stats = await fs.statfs(folder);
return {
available: stats.bavail * stats.bsize,
free: stats.bfree * stats.bsize,
total: stats.blocks * stats.bsize,
};
}
}

9747
server/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -59,7 +59,6 @@
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"cookie-parser": "^1.4.6",
"diskusage": "^1.1.3",
"exiftool-vendored": "^19.0.0",
"exiftool-vendored.pl": "^12.54.0",
"fluent-ffmpeg": "^2.1.2",
@ -77,7 +76,7 @@
"reflect-metadata": "^0.1.13",
"rxjs": "^7.2.0",
"sanitize-filename": "^1.6.3",
"sharp": "^0.28.0",
"sharp": "^0.31.0",
"typeorm": "^0.3.11",
"typesense": "^1.5.3",
"ua-parser-js": "^1.0.35"
@ -99,7 +98,7 @@
"@types/lodash": "^4.14.178",
"@types/multer": "^1.4.7",
"@types/mv": "^2.1.2",
"@types/node": "^16.0.0",
"@types/node": "^18.0.0",
"@types/sharp": "^0.30.2",
"@types/supertest": "^2.0.11",
"@types/ua-parser-js": "^0.7.36",

View file

@ -1,5 +1,5 @@
# Our Node base image
FROM node:16-alpine3.14 as base
FROM node:18-alpine3.17 as base
WORKDIR /usr/src/app
EXPOSE 3000