Minifying docker image.

This commit is contained in:
Dessalines 2023-10-31 08:38:26 -04:00
parent dd70d76b35
commit e505bf7766
3 changed files with 35 additions and 24 deletions

View file

@ -1,3 +1,4 @@
.git
node_modules
dist
lemmy-stats-crawler

View file

@ -24,13 +24,14 @@ RUN yarn docs
# Build the isomorphic app
FROM node:alpine as builder
RUN apk update && apk add yarn python3 build-base gcc wget git --no-cache
RUN apk update && apk add yarn python3 build-base gcc wget git curl --no-cache
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
WORKDIR /app
# Cache deps
COPY package.json yarn.lock ./
RUN yarn install --pure-lockfile
RUN yarn --production --prefer-offline --pure-lockfile
# Build
COPY tsconfig.json \
@ -48,9 +49,18 @@ COPY src src
COPY --from=docs /app/docs ./src/assets/docs
COPY --from=api /app/lemmy-js-client/docs ./src/assets/api
RUN yarn install --pure-lockfile
RUN yarn --production --prefer-offline
RUN yarn build:prod
# Prune the image
RUN node-prune ./node_modules
RUN rm -rf ./node_modules/import-sort-parser-typescript
RUN rm -rf ./node_modules/typescript
RUN rm -rf ./node_modules/npm
RUN du -sh ./node_modules/* | sort -nr | grep '\dM.*'
FROM node:alpine as runner
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/node_modules /app/node_modules

View file

@ -19,7 +19,6 @@
"repository": "https://github.com/LemmyNet/joinlemmy-site",
"dependencies": {
"@glidejs/glide": "3.5.2",
"@typescript-eslint/parser": "^6.7.5",
"classnames": "^2.3.2",
"express": "~4.18.2",
"i18next": "^23.5.1",
@ -29,51 +28,52 @@
"inferno-hydrate": "^8.2.2",
"inferno-i18next": "github:nimbusec-oss/inferno-i18next#semver:^7.4.2",
"inferno-router": "^8.2.2",
"tailwindcss": "^3.3.3",
"inferno-server": "^8.2.2",
"markdown-it": "^13.0.2",
"node-fetch": "^3.3.2",
"qrcode": "^1.5.3"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"webpack": "5.88.2",
"daisyui": "^3.9.2",
"@babel/runtime": "^7.23.2",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"run-node-webpack-plugin": "^1.3.0",
"@tailwindcss/typography": "^0.5.10",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/plugin-transform-typescript": "^7.22.15",
"markdown-it": "^13.0.2",
"babel-loader": "^9.1.3",
"@babel/preset-env": "7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@babel/runtime": "^7.23.2",
"@tailwindcss/typography": "^0.5.10",
"babel-plugin-inferno": "^6.7.0",
"@babel/core": "^7.23.2",
"webpack-node-externals": "^3.0.0",
"countries-list": "^2.6.1",
"node-fetch": "^3.3.2",
"webpack-cli": "^5.1.4",
"qrcode": "^1.5.3"
},
"devDependencies": {
"@typescript-eslint/parser": "^6.7.5",
"@types/express": "^4.17.19",
"@types/glidejs__glide": "^3.6.3",
"@types/node": "^20.8.4",
"@types/node-fetch": "^2.6.6",
"@types/qrcode": "^1.5.4",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"babel-loader": "^9.1.3",
"babel-plugin-inferno": "^6.7.0",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"countries-list": "^2.6.1",
"css-loader": "^6.8.1",
"daisyui": "^3.9.2",
"eslint": "^8.51.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"run-node-webpack-plugin": "^1.3.0",
"sass": "^1.69.3",
"sass-loader": "^13.3.2",
"sortpack": "^2.3.5",
"style-loader": "^3.3.3",
"tailwindcss": "^3.3.3",
"terser": "^5.21.0",
"typescript": "^5.2.2",
"webpack": "5.88.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "4.15.1",
"webpack-node-externals": "^3.0.0"
"webpack-dev-server": "4.15.1"
},
"engines": {
"node": ">=8.9.0"