Remove double package fetch

This commit is contained in:
Liam 2022-10-29 15:50:20 +01:00
parent 668d495c60
commit 044a70fd6c

@ -7,14 +7,14 @@ WORKDIR /app
# Copy cached files # Copy cached files
COPY node_modules /app COPY node_modules /app
# Install dependencies based on the preferred package manager # # Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ # COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \ # RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ # if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \ # elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ # elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \ # else echo "Lockfile not found." && exit 1; \
fi # fi
# Rebuild the source code only when needed # Rebuild the source code only when needed
FROM node:18-alpine AS builder FROM node:18-alpine AS builder