mirror of
https://github.com/seerr-team/seerr.git
synced 2026-05-19 06:07:27 -04:00
chore(deps): remove or replace unused/heavy dependencies to reduce Docker image size (#2974)
Co-authored-by: Ludovic Ortega <ludovic.ortega@adminafk.fr>
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -11,8 +11,25 @@ COPY . ./app
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS prod-deps
|
||||
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store CI=true pnpm install --prod --frozen-lockfile
|
||||
|
||||
# Remove large native modules for linux-x64-gnu platform (we use alpine which is musl-based)
|
||||
# not supported in pnpm for now due to this bug: https://github.com/pnpm/pnpm/issues/9654
|
||||
RUN du -shL ./node_modules/.pnpm/* | grep '[0-9]M.*' | grep 'linux-x64-gnu@' | awk '{print $2}' | xargs rm -rf
|
||||
# Remove large module files not needed for production
|
||||
RUN if [ -d node_modules/.pnpm ]; then \
|
||||
find node_modules/.pnpm -type d \( \
|
||||
-path "*ace-builds/src-noconflict" -o \
|
||||
-path "*ace-builds/src" -o \
|
||||
-path "*ace-builds/src-min" -o \
|
||||
-path "*country-flag-icons/react" -o \
|
||||
-path "*country-flag-icons/string" -o \
|
||||
-path "*country-flag-icons/1x1" -o \
|
||||
-path "*@heroicons/react/16" \
|
||||
\) -exec rm -rf {} + || true; \
|
||||
fi
|
||||
|
||||
FROM base AS build
|
||||
|
||||
ARG COMMIT_TAG
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
"copy-to-clipboard": "4.0.0",
|
||||
"country-flag-icons": "1.6.16",
|
||||
"cronstrue": "3.14.0",
|
||||
"date-fns": "4.1.0",
|
||||
"dns-caching": "^0.2.9",
|
||||
"email-templates": "13.0.1",
|
||||
"express": "4.21.2",
|
||||
@@ -66,6 +65,7 @@
|
||||
"gravatar-url": "4.0.1",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"humanize-duration": "^3.33.2",
|
||||
"js-yaml": "^4.1.1",
|
||||
"lodash": "4.18.1",
|
||||
"mime": "^4.1.0",
|
||||
@@ -127,6 +127,7 @@
|
||||
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
||||
"@types/express": "4.17.17",
|
||||
"@types/express-session": "1.18.2",
|
||||
"@types/humanize-duration": "^3.27.4",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/lodash": "4.17.24",
|
||||
"@types/mime": "^3.0.4",
|
||||
|
||||
2740
pnpm-lock.yaml
generated
2740
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,7 @@
|
||||
import { addYears } from 'date-fns';
|
||||
import { Between } from 'typeorm';
|
||||
|
||||
export const AfterDate = (date: Date) => Between(date, addYears(date, 100));
|
||||
export const AfterDate = (date: Date) => {
|
||||
const endDate = new Date(date.getTime());
|
||||
endDate.setFullYear(endDate.getFullYear() + 100);
|
||||
return Between(date, endDate);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'ace-builds/src-noconflict/ace';
|
||||
import 'ace-builds/src-noconflict/mode-json';
|
||||
import 'ace-builds/src-noconflict/theme-dracula';
|
||||
import 'ace-builds/src-min-noconflict/ace';
|
||||
import 'ace-builds/src-min-noconflict/mode-json';
|
||||
import 'ace-builds/src-min-noconflict/theme-dracula';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import AceEditor from 'react-ace';
|
||||
interface JSONEditorProps extends HTMLAttributes<HTMLDivElement> {
|
||||
|
||||
@@ -22,7 +22,7 @@ import type {
|
||||
import type { JobId } from '@server/lib/settings';
|
||||
import axios from 'axios';
|
||||
import cronstrue from 'cronstrue/i18n';
|
||||
import { formatDuration, intervalToDuration } from 'date-fns';
|
||||
import humanizeDuration from 'humanize-duration';
|
||||
import { Fragment, useReducer, useState } from 'react';
|
||||
import type { MessageDescriptor } from 'react-intl';
|
||||
import { FormattedRelativeTime, useIntl } from 'react-intl';
|
||||
@@ -319,14 +319,10 @@ const SettingsJobs = () => {
|
||||
};
|
||||
|
||||
const formatAge = (milliseconds: number): string => {
|
||||
const duration = intervalToDuration({
|
||||
start: 0,
|
||||
end: milliseconds,
|
||||
});
|
||||
|
||||
return formatDuration(duration, {
|
||||
format: ['minutes', 'seconds'],
|
||||
zero: false,
|
||||
return humanizeDuration(milliseconds, {
|
||||
units: ['m', 's'],
|
||||
round: true,
|
||||
language: locale,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user