import * as plugins from './tsdocker.plugins.js'; export interface IDockerfileSnippet { baseImage: string; command: string; } let getMountSolutionString = (optionsArg: IDockerfileSnippet) => { if (process.env.CI) { return 'COPY ./ /workspace'; } else { return '# not copying workspcae since not in CI'; } }; let getGlobalPreparationString = (optionsArg: IDockerfileSnippet) => { // Always install tsdocker to ensure the latest version is available return 'RUN npm install -g @git.zone/tsdocker'; }; export let dockerfileSnippet = (optionsArg: IDockerfileSnippet): string => { return plugins.smartstring.indent.normalize( ` FROM ${optionsArg.baseImage} # For info about what tsdocker does read the docs at https://gitzone.github.io/tsdocker ${getGlobalPreparationString(optionsArg)} ${getMountSolutionString(optionsArg)} WORKDIR /workspace ENV CI=true ENTRYPOINT ["tsdocker"] CMD ["runinside"] ` ); };