Coder Social home page Coder Social logo

qwbjtu2015 / dockerizeme Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dockerizeme/dockerizeme

0.0 1.0 0.0 21.57 MB

Automatically generate environment configurations as Dockerfiles

License: Apache License 2.0

Python 99.71% JavaScript 0.29% Dockerfile 0.01%

dockerizeme's Introduction

Dockerizeme

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

qwbjtu2015 avatar

Watchers

James Cloos avatar

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.