1 FROM node:20.2-alpine as builder
\r
2 RUN apk update && apk add curl yarn python3 build-base gcc wget git --no-cache
\r
3 RUN curl -sf https://gobinaries.com/tj/node-prune | sh
\r
7 ENV npm_config_target_arch=x64
\r
8 ENV npm_config_target_platform=linux
\r
9 ENV npm_config_target_libc=musl
\r
12 COPY package.json yarn.lock ./
\r
13 RUN yarn --production --prefer-offline --pure-lockfile
\r
16 COPY generate_translations.js \
\r
22 COPY lemmy-translations lemmy-translations
\r
27 RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
\r
29 RUN yarn --production --prefer-offline
\r
33 RUN node-prune /usr/src/app/node_modules
\r
35 RUN rm -rf ./node_modules/import-sort-parser-typescript
\r
36 RUN rm -rf ./node_modules/typescript
\r
37 RUN rm -rf ./node_modules/npm
\r
39 RUN du -sh ./node_modules/* | sort -nr | grep '\dM.*'
\r
41 FROM node:alpine as runner
\r
42 COPY --from=builder /usr/src/app/dist /app/dist
\r
43 COPY --from=builder /usr/src/app/node_modules /app/node_modules
\r
47 CMD node dist/js/server.js
\r