feat: Install pnpm into docker image if pnpm lock file is used

This commit is contained in:
Andras Bacsai
2022-03-11 23:55:57 +01:00
parent c6b4d04e26
commit 36c7e1a3c3
6 changed files with 36 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ export async function buildCacheImageWithNode(data, imageForBuild) {
secrets,
pullmergeRequestId
} = data;
const isPnpm = installCommand.includes('pnpm') || buildCommand.includes('pnpm');
const Dockerfile: Array<string> = [];
Dockerfile.push(`FROM ${imageForBuild}`);
Dockerfile.push('WORKDIR /usr/src/app');
@@ -35,7 +36,10 @@ export async function buildCacheImageWithNode(data, imageForBuild) {
}
});
}
// TODO: If build command defined, install command should be the default yarn install
if (isPnpm) {
Dockerfile.push('RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm');
Dockerfile.push('RUN pnpm add -g pnpm');
}
if (installCommand) {
Dockerfile.push(`COPY ./${baseDirectory || ''}package*.json ./`);
try {