@stencila/dockter
Advanced tools
Comparing version 0.10.4 to 0.11.0
@@ -9,5 +9,6 @@ import { SoftwareEnvironment } from '@stencila/schema'; | ||
* @param comments Should comments be added to the Dockerfile? | ||
* @param stencila Should relevant Stencila language packages be installed in the image? | ||
*/ | ||
compile(source: string, build?: boolean, comments?: boolean): Promise<SoftwareEnvironment | null>; | ||
compile(source: string, build?: boolean, comments?: boolean, stencila?: boolean): Promise<SoftwareEnvironment | null>; | ||
execute(source: string): Promise<string>; | ||
} |
@@ -21,4 +21,5 @@ "use strict"; | ||
* @param comments Should comments be added to the Dockerfile? | ||
* @param stencila Should relevant Stencila language packages be installed in the image? | ||
*/ | ||
async compile(source, build = true, comments = true) { | ||
async compile(source, build = true, comments = true, stencila = false) { | ||
let folder; | ||
@@ -62,3 +63,3 @@ if (source.substring(0, 7) === 'file://') { | ||
dockerfile = '.Dockerfile'; | ||
new DockerGenerator_1.default(environ, folder).generate(comments); | ||
new DockerGenerator_1.default(environ, folder).generate(comments, stencila); | ||
} | ||
@@ -65,0 +66,0 @@ if (build) { |
@@ -10,4 +10,5 @@ import Doer from './Doer'; | ||
* @param comments Should a comments be added to the Dockerfile? | ||
* @param stencila Should relevant Stencila language packages be installed in the image? | ||
*/ | ||
generate(comments?: boolean): string; | ||
generate(comments?: boolean, stencila?: boolean): string; | ||
applies(): boolean; | ||
@@ -14,0 +15,0 @@ baseName(): string; |
@@ -16,4 +16,5 @@ "use strict"; | ||
* @param comments Should a comments be added to the Dockerfile? | ||
* @param stencila Should relevant Stencila language packages be installed in the image? | ||
*/ | ||
generate(comments = true) { | ||
generate(comments = true, stencila = false) { | ||
let dockerfile = ''; | ||
@@ -75,7 +76,9 @@ if (comments) { | ||
} | ||
let stencilaInstall = this.stencilaInstall(baseIdentifier); | ||
if (stencilaInstall) { | ||
if (comments) | ||
dockerfile += '\n# This section runs commands to install Stencila execution hosts.'; | ||
dockerfile += `\nRUN ${stencilaInstall}\n`; | ||
if (stencila) { | ||
let stencilaInstall = this.stencilaInstall(baseIdentifier); | ||
if (stencilaInstall) { | ||
if (comments) | ||
dockerfile += '\n# This section runs commands to install Stencila execution hosts.'; | ||
dockerfile += `\nRUN ${stencilaInstall}\n`; | ||
} | ||
} | ||
@@ -82,0 +85,0 @@ // Once everything that needs root permissions is installed, switch the user to non-root for installing the rest of the packages. |
{ | ||
"name": "@stencila/dockter", | ||
"version": "0.10.4", | ||
"version": "0.11.0", | ||
"description": "A Docker image builder for researchers", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -20,4 +20,5 @@ import fs from 'fs' | ||
* @param comments Should comments be added to the Dockerfile? | ||
* @param stencila Should relevant Stencila language packages be installed in the image? | ||
*/ | ||
async compile (source: string, build: boolean = true, comments: boolean = true): Promise<SoftwareEnvironment | null> { | ||
async compile (source: string, build: boolean = true, comments: boolean = true, stencila: boolean = false): Promise<SoftwareEnvironment | null> { | ||
let folder | ||
@@ -61,3 +62,3 @@ if (source.substring(0, 7) === 'file://') { | ||
dockerfile = '.Dockerfile' | ||
new DockerGenerator(environ, folder).generate(comments) | ||
new DockerGenerator(environ, folder).generate(comments, stencila) | ||
} | ||
@@ -64,0 +65,0 @@ |
@@ -16,4 +16,5 @@ import Doer from './Doer' | ||
* @param comments Should a comments be added to the Dockerfile? | ||
* @param stencila Should relevant Stencila language packages be installed in the image? | ||
*/ | ||
generate (comments: boolean = true): string { | ||
generate (comments: boolean = true, stencila: boolean = false): string { | ||
let dockerfile = '' | ||
@@ -78,6 +79,8 @@ | ||
let stencilaInstall = this.stencilaInstall(baseIdentifier) | ||
if (stencilaInstall) { | ||
if (comments) dockerfile += '\n# This section runs commands to install Stencila execution hosts.' | ||
dockerfile += `\nRUN ${stencilaInstall}\n` | ||
if (stencila) { | ||
let stencilaInstall = this.stencilaInstall(baseIdentifier) | ||
if (stencilaInstall) { | ||
if (comments) dockerfile += '\n# This section runs commands to install Stencila execution hosts.' | ||
dockerfile += `\nRUN ${stencilaInstall}\n` | ||
} | ||
} | ||
@@ -84,0 +87,0 @@ |
@@ -38,3 +38,3 @@ import fs from 'fs' | ||
// Remove the date from the MRAN line to allow for changing date of test v expected | ||
const aptAddMRAN = /(apt-add-repository "deb https:\/\/mran.microsoft.com\/snapshot)\/([\d-]+)\/(bin\/linux\/ubuntu xenial\/)"/ | ||
const aptAddMRAN = /(apt-add-repository "deb https:\/\/mran.microsoft.com\/snapshot)\/([\d-]+)\/(bin\/linux\/ubuntu bionic-cran35\/)"/ | ||
const actual = fs.readFileSync(fixture('multi-lang/.Dockerfile'), 'utf8').replace(aptAddMRAN, '$1/YYYY-MM-DD/$3') | ||
@@ -41,0 +41,0 @@ const expected = fs.readFileSync(fixture('multi-lang/Dockerfile.expected'), 'utf8').replace(aptAddMRAN, '$1/YYYY-MM-DD/$3') |
@@ -82,4 +82,2 @@ import { SoftwarePackage } from '@stencila/schema' | ||
RUN pip install --no-cache-dir https://github.com/stencila/py/archive/91a05a139ac120a89fc001d9d267989f062ad374.zip | ||
RUN useradd --create-home --uid 1001 -s /bin/bash dockteruser | ||
@@ -86,0 +84,0 @@ USER dockteruser |
@@ -53,12 +53,2 @@ import fixture from './fixture' | ||
RUN apt-get update \\ | ||
&& apt-get install -y zlib1g-dev libxml2-dev pkg-config \\ | ||
&& apt-get autoremove -y \\ | ||
&& apt-get clean \\ | ||
&& rm -rf /var/lib/apt/lists/* \\ | ||
&& Rscript -e 'install.packages("devtools")' \\ | ||
&& Rscript -e 'source("https://bioconductor.org/biocLite.R"); biocLite("graph")' \\ | ||
&& Rscript -e 'devtools::install_github("r-lib/pkgbuild")' \\ | ||
&& Rscript -e 'devtools::install_github("stencila/r")' | ||
RUN useradd --create-home --uid 1001 -s /bin/bash dockteruser | ||
@@ -108,12 +98,2 @@ USER dockteruser | ||
RUN apt-get update \\ | ||
&& apt-get install -y zlib1g-dev libxml2-dev pkg-config \\ | ||
&& apt-get autoremove -y \\ | ||
&& apt-get clean \\ | ||
&& rm -rf /var/lib/apt/lists/* \\ | ||
&& Rscript -e 'install.packages("devtools")' \\ | ||
&& Rscript -e 'source("https://bioconductor.org/biocLite.R"); biocLite("graph")' \\ | ||
&& Rscript -e 'devtools::install_github("r-lib/pkgbuild")' \\ | ||
&& Rscript -e 'devtools::install_github("stencila/r")' | ||
RUN useradd --create-home --uid 1001 -s /bin/bash dockteruser | ||
@@ -120,0 +100,0 @@ USER dockteruser |
Sorry, the diff of this file is not supported yet
1350145
5891