Giter VIP home page Giter VIP logo

dockerizeme's Introduction

Dockerizeme

On Reproducibility

We have accepted #3 to transition to main/subordinate terms within the gists included in this repo. Some terms could not be changed due to dependence on external APIs, links, etc.

To see all gists as they were for the ICSE 2019 submission, check out one of our releases.

V2

If you are interested in DockerizeMe, you may also be interested in the companion project V2, which adds support for dependency versions.

Example (Dashtable)

Dashtable is a Python package for converting tables to different markdown formats. The following example (examples/dashtable/snippet.py) uses Dashtable to convert an HTML table into a gfm table.

import dashtable
print(dashtable.html2md("""
    <table>
        <tr><th>Header 1</th><th>Header 2</th></tr>
        <tr><td>Data 1</td><td>Data 2</td></tr>
    </table>
"""))

Attempting to run the code snippet results in an import error

$ python snippet.py
Traceback (most recent call last):
  File "snippet.py", line 1, in <module>
    import dashtable
ImportError: No module named dashtable

DockerizeMe can build an environment specification for the code snippet as a Dockerfile

dockerizeme --verbose snippet.py > Dockerfile
docker build -t dashtable .

The inferred environment contains the dependency dashtable. It also containsbeautifulsoup4, an HTML parsing library that Dashtable relies on for parsing HTML tables. Running the code snippet in the inferred environment prints the expected output

| Header 1 | Header 2 |
|----------|----------|
|  Data 1  |  Data 2  |

Vagrant

A local Vagrant configuration is provided for convenience.

vagrant up
vagrant ssh

DockerizeMe can be run on any of the included code snippets through vagrant. For example

cd /vagrant/examples/pylibmc
dockerizeme --verbose

Neo4J

DockerizeMe requires Neo4J to be reachable at bolt://localhost:7687. It can be started with

docker run --name=neo4j -d -p 7474:7474 -p 7687:7687 -v "$(pwd)/neo4j:/data" --env="NEO4J_AUTH=none" --restart-always neo4j

The neo4j browser can be accessed at http://localhost:7474/.

To back up a database, stop the container (if applicable) and then run the dump command

docker stop neo4j
docker run --rm -it -v "$(pwd)/neo4j:/data" neo4j neo4j-admin dump --to=/data/<filename>
docker start neo4j

To restore a database, stop the container (if applicable) and then run the restore command

docker stop neo4j
docker run --rm -it -v "$(pwd)/neo4j:/data" neo4j neo4j-admin load --force --from=/data/<filename>
docker start neo4j

DockerizeMe provides neo4j/neo4j.dump, a database backup containing the DockerizeMe database.

Usage

If cloning the repo

> npm run dockerizeme [-- [args]]

If installed globally

> dockerizeme [args]

As a module

const dockerizeme = require('dockerizeme');
(async () => {
    
    let contents = await dockerizeme(cmd, doc);
    console.log(contents);
    
})();

dockerizeme's People

Contributors

bopopescu avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dockerizeme's Issues

Error: spawn UNKNOWN

I couldn't get dockerizeme to run (also the instructions don't specify running npm install after cloning).

c:\repos\dockerizeme (master -> origin) ([email protected])
λ npm install
npm WARN [email protected] No repository field.

audited 142 packages in 0.852s
found 3 vulnerabilities (2 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

c:\repos\dockerizeme (master -> origin) ([email protected])
λ npm run dockerizeme

> [email protected] dockerizeme c:\repos\dockerizeme
> node src/bin.js

2019-06-15T14:44:17.190Z - error:  Error: spawn UNKNOWN
    at ChildProcess.spawn (internal/child_process.js:394:11)
    at spawn (child_process.js:539:9)
    at Object.execFile (child_process.js:221:17)
    at c:\repos\dockerizeme\src\language-strategy.js:179:70
    at tryCatcher (c:\repos\dockerizeme\node_modules\bluebird\js\release\util.js:16:23)
    at Function.Promise.fromNode.Promise.fromCallback (c:\repos\dockerizeme\node_modules\bluebird\js\release\promise.js:180:30)
    at PythonStrategy.parsePackageDependencies (c:\repos\dockerizeme\src\language-strategy.js:179:37)
    at c:\repos\dockerizeme\src\language-strategy.js:217:35
    at tryCatcher (c:\repos\dockerizeme\node_modules\bluebird\js\release\util.js:16:23)
    at c:\repos\dockerizeme\node_modules\bluebird\js\release\using.js:185:26
    at tryCatcher (c:\repos\dockerizeme\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (c:\repos\dockerizeme\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (c:\repos\dockerizeme\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (c:\repos\dockerizeme\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (c:\repos\dockerizeme\node_modules\bluebird\js\release\promise.js:693:18)
    at Promise._fulfill (c:\repos\dockerizeme\node_modules\bluebird\js\release\promise.js:638:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dockerizeme: `node src/bin.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dockerizeme script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Using Windows.

node 12.3.1
npm 6.9.0

How to install dockerizeme locally and use it for a Python script

I found this project really interesting but I am a bit confused about how to set up it propers. What steps should I follow to make it work. After tried all the commands in the README, I used the below command.
`
npm run dockerizeme --verbose examples/dashtable/snippet.py

`
But the results are :

`
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli '/usr/bin/npm',
npm verb cli 'run',
npm verb cli 'dockerizeme',
npm verb cli '--verbose',
npm verb cli 'examples/dashtable/snippet.py' ]
npm info using [email protected]
npm info using [email protected]
npm verb run-script [ 'predockerizeme', 'dockerizeme', 'postdockerizeme' ]
npm info lifecycle [email protected]predockerizeme: [email protected]
npm info lifecycle [email protected]
dockerizeme: [email protected]

[email protected] dockerizeme /home/jiawei/pysoot/dockerizeme
node src/bin.js "examples/dashtable/snippet.py"

module.js:549
throw err;
^

Error: Cannot find module 'yargs'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/home/jiawei/pysoot/dockerizeme/src/bin.js:11:19)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

`

Example dashtable can't recognize bs4

Hello.
I downloaded and tested DockerizeMe according to the README document. First, I started the neo4j container, and then I used command npm run dockerizeme --verbose examples/dashtable/snippet.py> Dockerfile and got the following result:

[email protected] dockerizeme /root/dockerizeme
node src/bin.js "examples/dashtable/snippet.py"
FROM python:2.7.13
COPY examples/dashtable/snippet.py /snippet.py
RUN ["pip","install","dashtable"]
CMD ["python","/snippet.py"]

The package dashtable depends on bs4. Why isn't it recognized here? Is the dynamic analysis feature temporarily unimplemented or am I using it incorrectly?
Thanks~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.