Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
fix(generate): don't ignore install parameters in base docker stage i…
Browse files Browse the repository at this point in the history
…nstall

#972
  • Loading branch information
rudxde committed Aug 25, 2022
1 parent c8741d1 commit 01ca83c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion packages/generate/src/lerna-command.ts
Expand Up @@ -42,7 +42,7 @@ export class Dockerize extends Command {
result.push(getDockerFileFromInstruction(baseStage.baseImage, baseStage.name, baseStage.platform));
result.push(...baseStage.stepsBeforeInstall);
if (baseStage.install) {
result.push(`RUN ${this.args.packageManager} install`);
result.push(this.baseStageInstallCommand(baseStage));
result.push(...baseStage.stepsAfterInstall);
}
}
Expand Down Expand Up @@ -75,6 +75,26 @@ export class Dockerize extends Command {
}
}

private baseStageInstallCommand(baseStage: DockerStage): string {
if (this.args.packageManager === 'yarn') {
return ([
'RUN',
this.args.packageManager,
'install',
...(baseStage.install?.ci ? ['--frozen-lockfile'] : []),
...(baseStage.install?.ignoreScripts ? ['--ignore-scripts'] : []),
...(baseStage.install?.onlyProduction ? ['--production'] : []),
].join(' '));
}
return ([
'RUN',
this.args.packageManager,
baseStage.install?.ci ? 'ci' : 'install',
...(baseStage.install?.ignoreScripts ? ['--ignore-scripts'] : []),
...(baseStage.install?.onlyProduction ? ['--production'] : []),
].join(' '));
}

private async createFinalStage(baseStage: DockerStage, packages: Package[]): Promise<string[]> {
const result: string[] = [];
result.push(`# final stage`);
Expand Down

0 comments on commit 01ca83c

Please sign in to comment.