Using corepack to install pnpm, instead of npm -g (#2431)

This commit is contained in:
Dessalines 2024-04-18 21:22:50 -04:00 committed by GitHub
parent f8d5543508
commit b608e8e525
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,4 @@
FROM node:21-alpine as builder
FROM node:alpine as builder
# Added vips-dev and pkgconfig so that local vips is used instead of prebuilt
# Done for two reasons:
@ -6,8 +6,11 @@ FROM node:21-alpine as builder
# - It can break depending on the CPU (https://github.com/LemmyNet/lemmy-ui/issues/1566)
RUN apk update && apk upgrade && apk add --no-cache curl python3 build-base gcc wget git vips-dev pkgconfig
# Install node-gyp and pnpm
RUN npm install -g pnpm node-gyp
# Enable corepack to use pnpm
RUN corepack enable
# Install node-gyp
RUN npm install -g node-gyp
WORKDIR /usr/src/app
@ -40,7 +43,7 @@ RUN rm -rf ./node_modules/import-sort-parser-typescript
RUN rm -rf ./node_modules/typescript
RUN rm -rf ./node_modules/npm
FROM node:21-alpine as runner
FROM node:alpine as runner
ENV NODE_ENV=production
RUN apk update && apk add --no-cache curl vips-cpp && rm -rf /var/cache/apk/*