-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
177 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# version: 0.1 | ||
|
||
From ubuntu | ||
|
||
ENV TINI_VERSION v0.9.0 | ||
RUN apt-get update && \ | ||
apt-get install -y curl wget gnupg bzip2 | ||
|
||
RUN wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O ~/miniconda.sh | ||
RUN chmod 0755 ~/miniconda.sh | ||
RUN ~/miniconda.sh -b -p ~/conda | ||
ENV PATH "~/conda/bin:$PATH" | ||
RUN ["/bin/bash", "-c", "conda create -n build_test python=3.4 && source activate build_test && conda install numpy"] | ||
|
||
# RUN conda activate bulid_test | ||
# RUN conda install scikit-learn | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/config-parser/base_docker.js → lib/config-parser/base-docker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const _ = require('lodash') | ||
|
||
const customCommand = require('./step-components/custom-command') | ||
const defaultStep = require('./step-components/default') | ||
|
||
const entrypointsList = [customCommand] | ||
|
||
function selectEntrypointBuilder (stepType) { | ||
return entrypointsList.find(item => item.type === stepType) | ||
} | ||
|
||
function buildSteps (config) { | ||
let dockerContent = '' | ||
for (let step of config.entrypoint_steps) { | ||
let entrypointBuilder = selectEntrypointBuilder(step.type) | ||
if (_.isNil(entrypointBuilder)) { | ||
// throw new Error(`cannot find step builder: '${step.type}'`) | ||
entrypointBuilder = defaultStep | ||
} | ||
dockerContent += ' ' + entrypointBuilder.build(step) | ||
} | ||
dockerContent = 'ENTRYPOINT' + dockerContent.substring(10, dockerContent.length - 6) + '\n\n' | ||
|
||
return dockerContent | ||
} | ||
|
||
module.exports = { | ||
type: 'entrypoint_steps', | ||
build: buildSteps | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const _ = require('lodash') | ||
|
||
const customCommand = require('./step-components/custom-command') | ||
const installPython = require('./step-components/install-python') | ||
const defaultStep = require('./step-components/default') | ||
|
||
const runStepsList = [customCommand, installPython] | ||
|
||
function selectRunBuilder (stepType) { | ||
return runStepsList.find(item => item.type === stepType) | ||
} | ||
|
||
function buildSteps (config) { | ||
let dockerContent = '' | ||
for (let step of config.run_steps) { | ||
let runBuilder = selectRunBuilder(step.type) | ||
if (_.isNil(runBuilder)) { | ||
// throw new Error(`cannot find step builder: '${step.type}'`) | ||
runBuilder = defaultStep | ||
} | ||
dockerContent += ' ' + runBuilder.build(step) | ||
} | ||
dockerContent = 'RUN' + dockerContent.substring(3, dockerContent.length - 6) + '\n\n' | ||
|
||
return dockerContent | ||
} | ||
|
||
module.exports = { | ||
type: 'run_steps', | ||
build: buildSteps | ||
} |
Empty file.
2 changes: 1 addition & 1 deletion
2
lib/config-parser/steps/custom_command.js → ...-parser/step-components/custom-command.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
function buildCustomInstall (step) { | ||
let dockerContent = '' | ||
dockerContent += `${step.config.command} && \\ \n` | ||
return dockerContent | ||
} | ||
|
||
module.exports = { | ||
'type': 'custom_command', | ||
'build': buildCustomInstall | ||
} |
2 changes: 1 addition & 1 deletion
2
lib/config-parser/steps/default.js → lib/config-parser/step-components/default.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const _ = require('lodash') | ||
|
||
function buildInstallConda (step) { | ||
let dockerContent = `git clone ${step.config.url} && \\ \n` | ||
|
||
// get git repo dir | ||
const repoNameReg = /\/([\w.@:-~_]+)\.git/ | ||
const repoName = repoNameReg.exec(step.config.url)[1] | ||
dockerContent += `cd ${repoName} && \\ \n` | ||
if (step.config.branch !== 'master') { | ||
dockerContent += `git checkout ${step.config.branch} && \\ \n` | ||
} | ||
if (!_.isNil(step.config.tag)) { | ||
dockerContent += `git checkout tags/${step.config.tag} && \\ \n` | ||
} | ||
|
||
return dockerContent | ||
} | ||
|
||
module.exports = { | ||
'type': 'install_conda', | ||
'build': buildInstallConda | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function buildInstallConda (step) { | ||
let dockerContent = `wget https://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O ~/miniconda.sh && \\ \n` + | ||
`bash ~/miniconda.sh -b -p $HOME/miniconda && \\ \n` + | ||
`export PATH="$HOME/miniconda/bin:$PATH && \\ \n"` + | ||
`conda -V && \\ \n` + | ||
`export CONDA_ENV_NAME='${step.config.env_name}' && \\ \n` + | ||
`conda create --yes -n $CONDA_ENV_NAME python=${step.config.python_version} && \\ \n` + | ||
`source activate $CONDA_ENV_NAME && \\ \n` | ||
|
||
return dockerContent | ||
} | ||
|
||
module.exports = { | ||
'type': 'install_conda', | ||
'build': buildInstallConda | ||
} |
2 changes: 1 addition & 1 deletion
2
lib/config-parser/steps/install_python.js → ...-parser/step-components/install-python.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters