├── .gitignore ├── .no-sublime-package ├── C++ in Docker Container.sublime-build ├── Clojure in Docker Container.sublime-build ├── Docker Compose.sublime-build ├── DockerBuild.py ├── DockerClojureBuild.py ├── DockerJavaBuild.py ├── Dockerfile.sublime-build ├── Go in Docker Container.sublime-build ├── Java in Docker Container.sublime-build ├── Maven in Docker Container.sublime-build ├── Perl in Docker Container.sublime-build ├── Python in Docker Container.sublime-build ├── README.md ├── Ruby in Docker Container.sublime-build ├── dockerutils.py ├── images ├── BuildSystems_SubMenu.png ├── Dockerfile_Menu_BuildSelection_Variants.png ├── Fig_Menu_BuildSelection_Variants.png ├── GO_Menu_BuildSelection_Variants.png ├── Java_Menu_BuildSelection_Variants.png └── old │ ├── BuildSystems_SubMenu.PNG │ ├── C++_Menu_BuildSelection_Variants.PNG │ ├── Java_Menu_BuildSelection_Variants.PNG │ ├── Perl_Menu_BuildSelection_Variants.PNG │ └── Python_Menu_BuildSelection_Variants.PNG ├── install_linux.sh ├── install_osx.sh ├── language-helloworlds ├── HelloWorld.cpp ├── HelloWorld.java ├── clojure │ ├── LICENSE │ ├── README.md │ ├── doc │ │ └── intro.md │ ├── project.clj │ ├── src │ │ └── hello │ │ │ └── helloworld.clj │ └── test │ │ └── hello │ │ └── core_test.clj ├── dockerfile │ ├── Dockerfile │ ├── index.js │ └── package.json ├── fig │ ├── Dockerfile │ ├── db.sqlite3 │ ├── fig.yml │ ├── figexample │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── settings.py │ │ ├── settings.pyc │ │ ├── urls.py │ │ ├── urls.pyc │ │ ├── wsgi.py │ │ └── wsgi.pyc │ ├── manage.py │ └── requirements.txt ├── go-version.go ├── javarun.sh ├── perl-version.pl ├── perl6-only.pl ├── python-version.py └── rubyversion.rb └── tests └── sublime_docker_tests.py /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.class 3 | __pycache__ 4 | -------------------------------------------------------------------------------- /.no-sublime-package: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/.no-sublime-package -------------------------------------------------------------------------------- /C++ in Docker Container.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "docker_build", 3 | "type": "RUN", 4 | "selector": "source.c++", 5 | "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]+)", 6 | "docker_image": "gcc", 7 | "docker_image_tag": "latest", 8 | "docker_image_exe": "g++", 9 | 10 | "variants": [ 11 | 12 | { "name": "C++ - g++ v4.9.2 in Docker Container", 13 | "docker_image_tag": "latest" 14 | }, 15 | 16 | { "name": "C++ - g++ for ARM/Raspberry Pi", 17 | "docker_image": "mjbright/raspberry-gcc", 18 | "docker_image_tag": "latest", 19 | "docker_image_exe": "/rpxc/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-c++" 20 | }, 21 | 22 | ] 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Clojure in Docker Container.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "docker_clojure_build", 3 | "type": "RUN", 4 | "selector": "source.clojure", 5 | "docker_image": "clojure", 6 | "docker_image_tag": "latest", 7 | "docker_image_exe": "lein run", 8 | 9 | "variants": [ 10 | 11 | { "name": "Clojure Leiningen v2.5.0 in Docker Container", 12 | "docker_image_tag": "2.5.0" 13 | }, 14 | 15 | { "name": "Clojure Leiningen v2.4.3 in Docker Container", 16 | "docker_image_tag": "2.4.3" 17 | }, 18 | ] 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Docker Compose.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "shell_cmd": "docker-compose up", 3 | "working_dir": "${project:file_path}", 4 | "variants": [ 5 | { "name": "Docker-compose build", 6 | "shell_cmd": "docker-compose build" 7 | }, 8 | { "name": "Docker-compose kill", 9 | "shell_cmd": "docker-compose kill" 10 | }, 11 | { "name": "Docker-compose ports", 12 | "shell_cmd": "docker-compose ports" 13 | }, 14 | { "name": "Docker-compose rm", 15 | "shell_cmd": "docker-compose rm" 16 | }, 17 | { "name": "Docker-compose stop", 18 | "shell_cmd": "docker-compose stop" 19 | }, 20 | { "name": "Docker-compose restart", 21 | "shell_cmd": "docker-compose restart" 22 | }, 23 | { "name": "Docker-compose ps", 24 | "shell_cmd": "docker-compose ps" 25 | }, 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /DockerBuild.py: -------------------------------------------------------------------------------- 1 | from . import dockerutils 2 | import sublime, sublime_plugin 3 | import os 4 | 5 | class DockerBuildCommand(sublime_plugin.WindowCommand): 6 | 7 | type = "RUN" 8 | docker_image = "python" 9 | docker_image_tag = "2.7xx" # Value seems to be unused? 10 | docker_image_exe = "python" 11 | 12 | def run(self, type="RUN", docker_image="python", docker_image_tag="2.7", docker_image_exe="python", file_regex='UNSET'): 13 | self.type = type 14 | self.docker_image = docker_image 15 | self.docker_image_tag = docker_image_tag 16 | self.docker_image_exe = docker_image_exe 17 | self.file_regex = file_regex 18 | self.file_name = dockerutils.getFileName() 19 | self.file_dir = dockerutils.getFileDir() 20 | 21 | 22 | if not dockerutils.isDockerInstalled(): 23 | dockerutils.isNotInstalledMessage() 24 | elif not dockerutils.isDockerRunning(): 25 | dockerutils.isNotRunningMessage() 26 | elif dockerutils.isUnsupportedFileType(self.file_name): 27 | sublime.status_message("Cannot " + type.lower() + " an unsupported file type") 28 | else: 29 | self.executeFile() 30 | 31 | 32 | def executeFile(self): 33 | if self.type == "RUN": 34 | opt_volume = " -v \"" + self.file_dir+"/\":/src" 35 | opt_temporary = " -t" 36 | image = " " + self.docker_image + ":" + self.docker_image_tag 37 | docker_cmd = dockerutils.getCommand() 38 | build_cmd = self.generateBuildCmd() 39 | command = [docker_cmd + " run" + opt_volume + opt_temporary + ' ' + dockerutils.opt_cleanup + image + build_cmd] 40 | dockerutils.logDockerCommand(command) 41 | else: 42 | self.errorMessage("Unknown command: " + self.type) 43 | return 44 | 45 | dockerutils.getView().window().run_command("exec", { 'kill': True }) 46 | dockerutils.getView().window().run_command("exec", { 47 | 'shell': True, 48 | 'cmd': command, 49 | 'working_dir' : self.file_dir, 50 | 'file_regex' : self.file_regex 51 | }) 52 | 53 | 54 | def generateBuildCmd(self): 55 | cpp_check_list = ["gcc", "g++", "cpp", "c++"] 56 | exec_cmd = "" 57 | if any(map(lambda x: x in self.docker_image or x in self.docker_image_exe, cpp_check_list)): 58 | exec_cmd = "./a.out;" 59 | build_cmd = " " + self.docker_image_exe + " \"/src/" + self.file_name + "\"; " 60 | build_cmd = " bash -c 'cd /src; " + build_cmd + exec_cmd + "'" 61 | return build_cmd 62 | -------------------------------------------------------------------------------- /DockerClojureBuild.py: -------------------------------------------------------------------------------- 1 | from . import dockerutils 2 | import sublime, sublime_plugin 3 | import os, re 4 | 5 | class DockerClojureBuildCommand(sublime_plugin.WindowCommand): 6 | 7 | type = "RUN" 8 | docker_image = "clojure" 9 | docker_image_tag = "2.5.0" 10 | docker_image_exe = "lein run" 11 | 12 | def run(self, type="RUN", docker_image="clojure", docker_image_tag="2.5.0", docker_image_exe="lein run", file_regex='UNSET'): 13 | self.type = type 14 | self.docker_image = docker_image 15 | self.docker_image_tag = docker_image_tag 16 | self.docker_image_exe = docker_image_exe 17 | self.file_regex = file_regex 18 | self.file_name = dockerutils.getFileName() 19 | self.file_dir = dockerutils.getFileDir() 20 | components = self.file_dir.split(os.sep) 21 | self.project_dir = str.join(os.sep, components[:components.index("src")]) 22 | self.file_dir_relative_to_project = str.join(os.sep, components[components.index("src"):]) 23 | self.file_dir_relative_to_src = str.join(os.sep, components[components.index("src")+1:]) 24 | 25 | if not dockerutils.isDockerInstalled: 26 | dockerutils.isNotInstalledMessage() 27 | elif not dockerutils.isDockerRunning(): 28 | dockerutils.isNotRunningMessage() 29 | elif dockerutils.isUnsupportedFileType(self.file_name): 30 | sublime.status_message("Cannot " + type.lower() + " an unsupported file type") 31 | else: 32 | self.executeFile() 33 | 34 | 35 | def executeFile(self): 36 | if self.type == "RUN": 37 | opt_volume = " -v \"" + self.project_dir+"/\":/leinproject" 38 | opt_temporary = " -t" 39 | opt_working_dir = " -w=\""+ "/leinproject/" + "\"" 40 | image = " " + self.docker_image + ":" + self.docker_image_tag 41 | build_cmd = " " + self.docker_image_exe 42 | docker_cmd = dockerutils.getCommand() 43 | command = [docker_cmd + " run" + opt_volume + opt_temporary + ' ' + dockerutils.opt_cleanup + opt_working_dir + image + build_cmd] 44 | dockerutils.logDockerCommand(command) 45 | else: 46 | self.errorMessage("Unknown command: " + self.type) 47 | return 48 | 49 | dockerutils.getView().window().run_command("exec", { 'kill': True }) 50 | dockerutils.getView().window().run_command("exec", { 51 | 'shell': True, 52 | 'cmd': command, 53 | 'working_dir' : self.file_dir, 54 | 'file_regex' : self.file_regex 55 | }) 56 | 57 | -------------------------------------------------------------------------------- /DockerJavaBuild.py: -------------------------------------------------------------------------------- 1 | from . import dockerutils 2 | import sublime, sublime_plugin 3 | import os 4 | 5 | 6 | class DockerJavaBuildCommand(sublime_plugin.WindowCommand): 7 | 8 | type = "RUN" 9 | docker_image = "java" 10 | docker_image_tag = "2.7xx" # Value seems to be unused? 11 | build_exe = "javac" 12 | run_exe = "/src/javarun.sh" 13 | 14 | def run(self, type="RUN", docker_image="java", docker_image_tag="2.7"): 15 | self.type = type 16 | self.docker_image = docker_image 17 | self.docker_image_tag = docker_image_tag 18 | self.file_name = dockerutils.getFileName() 19 | self.file_dir = dockerutils.getFileDir() 20 | 21 | if not dockerutils.isDockerInstalled: 22 | dockerutils.isNotInstalledMessage() 23 | elif not dockerutils.isDockerRunning(): 24 | dockerutils.isNotRunningMessage() 25 | elif dockerutils.isUnsupportedFileType(self.file_name): 26 | sublime.status_message("Cannot " + type.lower() + " an unsupported file type") 27 | else: 28 | self.executeFile() 29 | 30 | 31 | def executeFile(self): 32 | if self.type == "RUN": 33 | opt_volume = " -v \"" + self.file_dir+"/\":/src" 34 | opt_temporary = " -t" 35 | image = " " + self.docker_image + ":" + self.docker_image_tag 36 | #build_cmd = " " + self.build_exe + " \"/src/"+self.file_name + "\" && " + self.run_exe + " " + os.path.splitext(self.file_name)[0] 37 | build_cmd = " " + self.run_exe + " \"/src/" + self.file_name + "\"" 38 | docker_cmd = dockerutils.getCommand() 39 | command = [docker_cmd + " run" + opt_volume + opt_temporary + ' ' + dockerutils.opt_cleanup + image + build_cmd] 40 | elif self.type == "BUILD": 41 | opt_volume = " -v " + self.file_dir+"/:/src" 42 | opt_temporary = " -t" 43 | image = " " + self.docker_image + ":" + self.docker_image_tag 44 | build_cmd = " " + self.build_exe + " /src/"+self.file_name 45 | docker_cmd = dockerutils.getCommand() 46 | command = [docker_cmd + " run" + opt_volume + opt_temporary + ' ' + dockerutils.opt_cleanup + image + build_cmd] 47 | dockerutils.logDockerCommand(command) 48 | else: 49 | self.errorMessage("Unknown command: " + self.type) 50 | return 51 | 52 | 53 | dockerutils.getView().window().run_command("exec", { 'kill': True }) 54 | dockerutils.getView().window().run_command("exec", { 55 | 'shell': True, 56 | 'cmd': command, 57 | 'working_dir' : self.file_dir 58 | }) 59 | 60 | 61 | -------------------------------------------------------------------------------- /Dockerfile.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "shell_cmd": "docker build -t sublime-docker-`date +%s` \"$file_path\"", 3 | "selector": "source.dockerfile", 4 | "variants": [ 5 | { "name": "Dockerfile run in background", 6 | "shell_cmd": "docker build -t sublime-docker-`date +%s` \"$file_path\" && (docker images -q | head -1) | xargs docker run -P -d | xargs docker port" 7 | }, 8 | { "name": "Dockerfile run in foreground non interactive", 9 | "shell_cmd": "docker build -t sublime-docker-`date +%s` \"$file_path\" && (docker images -q | head -1) | xargs docker run -P -t --rm" 10 | }, 11 | { "name": "Dockerfile deploy to GAE", 12 | "shell_cmd": "echo not implemented yet" 13 | }, 14 | { "name": "Dockerfile deploy to Deis", 15 | "shell_cmd": "echo not implemented yet" 16 | }, 17 | { "name": "Dockerfile deploy to OVH", 18 | "shell_cmd": "echo not implemented yet" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Go in Docker Container.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "docker_build", 3 | "type": "RUN", 4 | "selector": "source.go", 5 | "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]+)", 6 | "docker_image": "golang", 7 | "docker_image_tag": "latest", 8 | "docker_image_exe": "go run", 9 | 10 | "variants": [ 11 | 12 | { "name": "Go v1.3 in Docker Container", 13 | "docker_image_tag": "1.3" 14 | }, 15 | 16 | { "name": "Go v1.4 in Docker Container", 17 | "docker_image_tag": "1.4" 18 | }, 19 | ] 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Java in Docker Container.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "docker_java_build", 3 | "type": "RUN", 4 | "selector": "source.java", 5 | "docker_image": "java", 6 | "docker_image_tag": "latest", 7 | 8 | "variants": [ 9 | 10 | { "name": "Java v1.7.0_65 in Docker Container (RUN)", 11 | "docker_image_tag": "latest", 12 | "type": "RUN" 13 | }, 14 | 15 | { "name": "Java v1.7.0_65 in Docker Container (BUILD)", 16 | "docker_image_tag": "latest", 17 | "type": "BUILD" 18 | }, 19 | 20 | { "name": "[TODO] Android SDK in Docker Container", 21 | "docker_image": "android-sdk-TODO", 22 | "docker_image_tag": "latest", 23 | "type": "BUILD" 24 | }, 25 | 26 | ] 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Maven in Docker Container.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "docker_build", 3 | "type": "RUN", 4 | "selector": "source.maven", 5 | "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]+)", 6 | "docker_image": "maven", 7 | "docker_image_tag": "latest", 8 | "docker_image_exe": "mvn clean install -f ", 9 | 10 | "variants": [ 11 | 12 | { "name": "Maven clean v3.3.1 with jdk 7 in Docker Container", 13 | "docker_image_exe": "mvn clean -f ", 14 | "docker_image_tag": "3.3.1-jdk-7" 15 | }, 16 | 17 | { "name": "Maven clean v3.3.1 with jdk 8 in Docker Container", 18 | "docker_image_exe": "mvn clean -f ", 19 | "docker_image_tag": "3.3.1-jdk-8" 20 | }, 21 | 22 | { "name": "Maven install v3.3.1 with jdk 7 in Docker Container", 23 | "docker_image_exe": "mvn install -f ", 24 | "docker_image_tag": "3.3.1-jdk-7" 25 | }, 26 | 27 | { "name": "Maven install v3.3.1 with jdk 8 in Docker Container", 28 | "docker_image_exe": "mvn install -f ", 29 | "docker_image_tag": "3.3.1-jdk-8" 30 | }, 31 | 32 | { "name": "Maven clean install v3.3.1 with jdk 7 in Docker Container", 33 | "docker_image_tag": "3.3.1-jdk-7" 34 | }, 35 | 36 | { "name": "Maven clean install v3.3.1 with jdk 8 in Docker Container", 37 | "docker_image_tag": "3.3.1-jdk-8" 38 | }, 39 | ] 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Perl in Docker Container.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "docker_build", 3 | "type": "RUN", 4 | "selector": "source.perl", 5 | "docker_image": "perl", 6 | "docker_image_tag": "latest", 7 | "docker_image_exe": "perl", 8 | 9 | "variants": [ 10 | 11 | { "name": "Perl v5.20.0 in Docker Container", 12 | "docker_image_tag": "latest" 13 | }, 14 | 15 | { "name": "Perl v6 2014.09 MoarVM in Docker Container", 16 | "docker_image": "pmakholm/perl6", 17 | "docker_image_tag": "latest", 18 | "docker_image_exe": "perl6" 19 | }, 20 | ] 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Python in Docker Container.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "docker_build", 3 | "type": "RUN", 4 | "selector": "source.python", 5 | "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]+)", 6 | "docker_image": "python", 7 | "docker_image_tag": "latest", 8 | "docker_image_exe": "python", 9 | 10 | "variants": [ 11 | 12 | { "name": "Python v2.7 in Docker Container", 13 | "docker_image_tag": "2.7" 14 | }, 15 | 16 | { "name": "Python v3.4 in Docker Container", 17 | "docker_image_tag": "3.4" 18 | }, 19 | ] 20 | } 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SublimeDocker 2 | ============= 3 | 4 | A Sublime Text package that include some build systems that use [Docker Language Stacks](http://blog.docker.com/2014/09/docker-hub-official-repos-announcing-language-stacks/). It currently build python, ruby, perl, c/c++ (gcc), clojure, go (golang), java, Dockerfile and Fig configuration files. 5 | 6 | # Prerequisite 7 | 8 | Requires Docker. You can get it here https://get.docker.com/. 9 | 10 | Your user [should belong to the Docker group](https://docs.docker.com/installation/ubuntulinux/#giving-non-root-access) to run docker without using `sudo`. 11 | 12 | # Installation 13 | 14 | Install using [SublimeText PackageControl](http://wbond.net/sublime_packages/package_control). Otherwise you can also Download/Clone the package and put it in your Packages-directory. 15 | 16 | # Usage 17 | 18 | After installing, you will find new options in `Tools > Build system` of your Sublime menu: 19 | 20 | - C++ in Docker Container 21 | - Clojure in Docker Container 22 | - Dockerfile 23 | - Fig 24 | - Go in Docker Container 25 | - Java in Docker Container 26 | - Perl in Docker Container 27 | - Python in Docker Container 28 | - Ruby in Docker Container 29 | 30 | 31 | ### Build and run using Docker containers 32 | 33 | ![Build System Menu](images/BuildSystems_SubMenu.png "Build System Menu") 34 | 35 | Remember, you can always launch the selected build with `Control+B` (Linux/Windows) or `Command+B` (OS X). 36 | 37 | ### Select different versions 38 | 39 | You can select specific interpreter/compiler variants with `Control+Shift+P` (Linux/Windows) or `Command+Shift+P` (OS X) 40 | and typing build to reduce the selection to the available build variants for the selected build system as shown below for various language build systems. 41 | ![Build Variants](images/GO_Menu_BuildSelection_Variants.png "Build Variants") 42 | ![Build Variants](images/Java_Menu_BuildSelection_Variants.png "Build Variants") 43 | 44 | ### Dockerfile: build images and run containers with a dockerfile 45 | ![Build Variants](images/Dockerfile_Menu_BuildSelection_Variants.png "Build Variants") 46 | 47 | ### Fig: Run multiple containers using fig.yml file 48 | ![Build Variants](images/Fig_Menu_BuildSelection_Variants.png "Build Variants") 49 | -------------------------------------------------------------------------------- /Ruby in Docker Container.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "docker_build", 3 | "type": "RUN", 4 | "selector": "source.ruby", 5 | "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]+)", 6 | "docker_image": "ruby", 7 | "docker_image_tag": "latest", 8 | "docker_image_exe": "ruby", 9 | 10 | "variants": [ 11 | 12 | { "name": "Ruby v1.9.3 in Docker Container", 13 | "docker_image_tag": "1.9.3" 14 | }, 15 | 16 | { "name": "Ruby v2.1.5 in Docker Container", 17 | "docker_image_tag": "2.1" 18 | }, 19 | ] 20 | } 21 | 22 | -------------------------------------------------------------------------------- /dockerutils.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | import os, re, subprocess 3 | import time, shutil 4 | import os.path 5 | 6 | opt_cleanup = '--rm' 7 | 8 | # Used by logDockerCommand(command) below: 9 | #SUBLIME_DOCKER_LOGFILE='/tmp/sublime-docker.log' 10 | SUBLIME_DOCKER_LOGFILE=None 11 | 12 | DOCKER_NOT_INSTALLED_LINUX_MSG='''Docker is not installed. 13 | 14 | Install it to use SublimeDocker: open a Terminal and run 15 | 'curl -sSL https://get.docker.com/ | sh' 16 | ''' 17 | 18 | DOCKER_NOT_INSTALLED_OSX_MSG='''Docker is not installed. 19 | 20 | Install it to use SublimeDocker. Visit the following URL for installation instructions: 21 | 22 | https://docs.docker.com/en/latest/installation/ 23 | ''' 24 | 25 | DOCKER_NOT_RUNNING_LINUX_MSG='''Docker engine is not running. 26 | 27 | Start it to use SublimeDocker. 28 | ''' 29 | DOCKER_NOT_RUNNING_OSX_MSG='''Docker engine is not running. 30 | 31 | Start it to use SublimeDocker: open a Terminal and run 'docker-machine start $(docker-machine active)' or 'boot2docker up' 32 | ''' 33 | 34 | def isDockerInstalled(): 35 | platform = sublime.platform() 36 | if platform == 'linux': 37 | return isDockerInstalledOnLinux() 38 | if platform == 'osx': 39 | return isDockerInstalledOnOSX() 40 | 41 | def isDockerRunning(): 42 | platform = sublime.platform() 43 | if platform == 'linux': 44 | return isDockerRunningOnLinux() 45 | if platform == 'osx': 46 | return isDockerRunningOnOSX() 47 | 48 | def isDockerRunningOnLinux(): 49 | """ Check is Docker daemon is running: 50 | We assume that the path to the daemon which appears in full ps output 51 | is of the form */bin/docker 52 | """ 53 | if len(os.popen("ps -aef | grep '/bin/docker ' | grep -v grep").read().strip()) > 0: 54 | return True 55 | if len(os.popen("ps -aef | grep '/bin/docker.io ' | grep -v grep").read().strip()) > 0: 56 | return True 57 | return False 58 | 59 | def isDockerRunningOnOSX(): 60 | return ( 61 | (os.path.isfile('/usr/local/bin/boot2docker') 62 | and isBoot2DockerRunning()) or 63 | (os.path.isfile('/usr/local/bin/docker-machine') 64 | and isDockerMachineRunning())) 65 | 66 | 67 | def isBoot2DockerRunning(): 68 | if len(os.popen("ps -aef | grep 'boot2docker' | grep -v grep").read().strip()) < 1: 69 | return False 70 | try: 71 | os.environ["DOCKER_HOST"] 72 | os.environ["DOCKER_CERT_PATH"] 73 | os.environ["DOCKER_TLS_VERIFY"] 74 | except KeyError: 75 | boot2docker_init_cmd = subprocess.check_output(["/usr/local/bin/boot2docker", "shellinit"], stderr=None).strip() 76 | env = dict(re.findall(r'(\S+)=(".*?"|\S+)', boot2docker_init_cmd.decode())) 77 | for key,value in env.items(): 78 | os.environ[key]=value 79 | return True 80 | 81 | def isDockerMachineRunning(): 82 | machine_ls = os.popen("/usr/local/bin/docker-machine ls -q").read().strip() 83 | if len(machine_ls) < 1: 84 | return False 85 | try: 86 | os.environ["DOCKER_HOST"] 87 | os.environ["DOCKER_CERT_PATH"] 88 | os.environ["DOCKER_TLS_VERIFY"] 89 | os.environ["DOCKER_MACHINE_NAME"] 90 | except KeyError: 91 | setEnvVariables() 92 | return True 93 | 94 | def isDockerInstalledOnLinux(): 95 | if shutil.which('docker') != None : 96 | return True 97 | return False 98 | 99 | def isDockerInstalledOnOSX(): 100 | 101 | if not os.path.isfile('/usr/local/bin/docker'): 102 | print("which(docker) returned None") 103 | return False 104 | if not os.path.isfile('/usr/local/bin/boot2docker') and not os.path.isfile('/usr/local/bin/docker-machine'): 105 | print("which(boot2docker and docker-machine) returned None") 106 | return False 107 | return True 108 | 109 | def isNotRunningMessage(): 110 | platform = sublime.platform() 111 | if platform == 'linux': 112 | isNotRunningMessageLinux() 113 | if platform == 'osx': 114 | isNotRunningMessageOSX() 115 | 116 | def isNotInstalledMessage(): 117 | platform = sublime.platform() 118 | if platform == 'linux': 119 | isNotInstalledMessageLinux() 120 | if platform == 'osx': 121 | isNotInstalledMessageOSX() 122 | 123 | def isNotInstalledMessageLinux(): 124 | sublime.error_message(DOCKER_NOT_INSTALLED_LINUX_MSG) 125 | 126 | def isNotInstalledMessageOSX(): 127 | sublime.error_message(DOCKER_NOT_INSTALLED_OSX_MSG) 128 | 129 | def isNotRunningMessageLinux(): 130 | sublime.error_message(DOCKER_NOT_RUNNING_LINUX_MSG) 131 | 132 | def isNotRunningMessageOSX(): 133 | sublime.error_message(DOCKER_NOT_RUNNING_OSX_MSG) 134 | 135 | def isUnsupportedFileType(file_name): 136 | return False 137 | 138 | def getFileFullPath(): 139 | win = sublime.active_window() 140 | if win: 141 | view = win.active_view() 142 | if view and view.file_name(): 143 | return view.file_name() 144 | return "" 145 | 146 | def getFileDir(): 147 | filefullpath = getFileFullPath() 148 | dirname = os.path.dirname(filefullpath) 149 | if os.path.exists(dirname): 150 | return dirname 151 | else: 152 | return "" 153 | 154 | def getFileName(): 155 | filefullpath = getFileFullPath() 156 | return os.path.basename(filefullpath) 157 | 158 | def getView(): 159 | win = sublime.active_window() 160 | return win.active_view() 161 | 162 | def getCommand(): 163 | platform = sublime.platform() 164 | if platform == 'linux': 165 | return "docker" 166 | if platform == 'osx': 167 | return "/usr/local/bin/docker" 168 | 169 | def logDockerCommand(command): 170 | if SUBLIME_DOCKER_LOGFILE != None: 171 | with open(SUBLIME_DOCKER_LOGFILE, 'a+') as f: 172 | f.write(time.strftime("\n%d/%m/%Y %H:%M:%S ") + str(command)) 173 | f.close() 174 | 175 | def setEnvVariables(): 176 | env_out = run_machine_env() 177 | vars = dict(re.findall(r'(\S+)=(".*?"|\S+)', env_out)) 178 | for key,value in vars.items(): 179 | os.environ[key]=value.strip('"') 180 | 181 | def run_machine_env(): 182 | home_dir = os.path.expanduser('~') 183 | cmd = "/usr/local/bin/docker-machine -s " + home_dir + "/.docker/machine env default" 184 | return os.popen(cmd).read().strip() 185 | -------------------------------------------------------------------------------- /images/BuildSystems_SubMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/BuildSystems_SubMenu.png -------------------------------------------------------------------------------- /images/Dockerfile_Menu_BuildSelection_Variants.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/Dockerfile_Menu_BuildSelection_Variants.png -------------------------------------------------------------------------------- /images/Fig_Menu_BuildSelection_Variants.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/Fig_Menu_BuildSelection_Variants.png -------------------------------------------------------------------------------- /images/GO_Menu_BuildSelection_Variants.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/GO_Menu_BuildSelection_Variants.png -------------------------------------------------------------------------------- /images/Java_Menu_BuildSelection_Variants.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/Java_Menu_BuildSelection_Variants.png -------------------------------------------------------------------------------- /images/old/BuildSystems_SubMenu.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/old/BuildSystems_SubMenu.PNG -------------------------------------------------------------------------------- /images/old/C++_Menu_BuildSelection_Variants.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/old/C++_Menu_BuildSelection_Variants.PNG -------------------------------------------------------------------------------- /images/old/Java_Menu_BuildSelection_Variants.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/old/Java_Menu_BuildSelection_Variants.PNG -------------------------------------------------------------------------------- /images/old/Perl_Menu_BuildSelection_Variants.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/old/Perl_Menu_BuildSelection_Variants.PNG -------------------------------------------------------------------------------- /images/old/Python_Menu_BuildSelection_Variants.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/images/old/Python_Menu_BuildSelection_Variants.PNG -------------------------------------------------------------------------------- /install_linux.sh: -------------------------------------------------------------------------------- 1 | cp *.sublime-build DockerBuild.py DockerClojureBuild.py DockerJavaBuild.py dockerutils.py ~/.config/sublime-text-3/Packages/User/ 2 | -------------------------------------------------------------------------------- /install_osx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | export OSX_PKG_FOLDER=~/Library/Application\ Support/Sublime\ Text\ 3/Packages/Docker\ Based\ Build\ Systems/ 5 | 6 | 7 | cp *.sublime-build DockerBuild.py DockerClojureBuild.py DockerJavaBuild.py dockerutils.py "$OSX_PKG_FOLDER" 8 | 9 | -------------------------------------------------------------------------------- /language-helloworlds/HelloWorld.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | cout << "Hello World from C++ !!" << endl; 8 | return 1; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /language-helloworlds/HelloWorld.java: -------------------------------------------------------------------------------- 1 | public class HelloWorld { 2 | 3 | public static void main(String[] args) { 4 | System.out.println("Hello, World from Java - " + System.getProperty("java.version") ); 5 | } 6 | 7 | } 8 | 9 | -------------------------------------------------------------------------------- /language-helloworlds/clojure/LICENSE: -------------------------------------------------------------------------------- 1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC 2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM 3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 4 | 5 | 1. DEFINITIONS 6 | 7 | "Contribution" means: 8 | 9 | a) in the case of the initial Contributor, the initial code and 10 | documentation distributed under this Agreement, and 11 | 12 | b) in the case of each subsequent Contributor: 13 | 14 | i) changes to the Program, and 15 | 16 | ii) additions to the Program; 17 | 18 | where such changes and/or additions to the Program originate from and are 19 | distributed by that particular Contributor. A Contribution 'originates' from 20 | a Contributor if it was added to the Program by such Contributor itself or 21 | anyone acting on such Contributor's behalf. Contributions do not include 22 | additions to the Program which: (i) are separate modules of software 23 | distributed in conjunction with the Program under their own license 24 | agreement, and (ii) are not derivative works of the Program. 25 | 26 | "Contributor" means any person or entity that distributes the Program. 27 | 28 | "Licensed Patents" mean patent claims licensable by a Contributor which are 29 | necessarily infringed by the use or sale of its Contribution alone or when 30 | combined with the Program. 31 | 32 | "Program" means the Contributions distributed in accordance with this 33 | Agreement. 34 | 35 | "Recipient" means anyone who receives the Program under this Agreement, 36 | including all Contributors. 37 | 38 | 2. GRANT OF RIGHTS 39 | 40 | a) Subject to the terms of this Agreement, each Contributor hereby grants 41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to 42 | reproduce, prepare derivative works of, publicly display, publicly perform, 43 | distribute and sublicense the Contribution of such Contributor, if any, and 44 | such derivative works, in source code and object code form. 45 | 46 | b) Subject to the terms of this Agreement, each Contributor hereby grants 47 | Recipient a non-exclusive, worldwide, royalty-free patent license under 48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise 49 | transfer the Contribution of such Contributor, if any, in source code and 50 | object code form. This patent license shall apply to the combination of the 51 | Contribution and the Program if, at the time the Contribution is added by the 52 | Contributor, such addition of the Contribution causes such combination to be 53 | covered by the Licensed Patents. The patent license shall not apply to any 54 | other combinations which include the Contribution. No hardware per se is 55 | licensed hereunder. 56 | 57 | c) Recipient understands that although each Contributor grants the licenses 58 | to its Contributions set forth herein, no assurances are provided by any 59 | Contributor that the Program does not infringe the patent or other 60 | intellectual property rights of any other entity. Each Contributor disclaims 61 | any liability to Recipient for claims brought by any other entity based on 62 | infringement of intellectual property rights or otherwise. As a condition to 63 | exercising the rights and licenses granted hereunder, each Recipient hereby 64 | assumes sole responsibility to secure any other intellectual property rights 65 | needed, if any. For example, if a third party patent license is required to 66 | allow Recipient to distribute the Program, it is Recipient's responsibility 67 | to acquire that license before distributing the Program. 68 | 69 | d) Each Contributor represents that to its knowledge it has sufficient 70 | copyright rights in its Contribution, if any, to grant the copyright license 71 | set forth in this Agreement. 72 | 73 | 3. REQUIREMENTS 74 | 75 | A Contributor may choose to distribute the Program in object code form under 76 | its own license agreement, provided that: 77 | 78 | a) it complies with the terms and conditions of this Agreement; and 79 | 80 | b) its license agreement: 81 | 82 | i) effectively disclaims on behalf of all Contributors all warranties and 83 | conditions, express and implied, including warranties or conditions of title 84 | and non-infringement, and implied warranties or conditions of merchantability 85 | and fitness for a particular purpose; 86 | 87 | ii) effectively excludes on behalf of all Contributors all liability for 88 | damages, including direct, indirect, special, incidental and consequential 89 | damages, such as lost profits; 90 | 91 | iii) states that any provisions which differ from this Agreement are offered 92 | by that Contributor alone and not by any other party; and 93 | 94 | iv) states that source code for the Program is available from such 95 | Contributor, and informs licensees how to obtain it in a reasonable manner on 96 | or through a medium customarily used for software exchange. 97 | 98 | When the Program is made available in source code form: 99 | 100 | a) it must be made available under this Agreement; and 101 | 102 | b) a copy of this Agreement must be included with each copy of the Program. 103 | 104 | Contributors may not remove or alter any copyright notices contained within 105 | the Program. 106 | 107 | Each Contributor must identify itself as the originator of its Contribution, 108 | if any, in a manner that reasonably allows subsequent Recipients to identify 109 | the originator of the Contribution. 110 | 111 | 4. COMMERCIAL DISTRIBUTION 112 | 113 | Commercial distributors of software may accept certain responsibilities with 114 | respect to end users, business partners and the like. While this license is 115 | intended to facilitate the commercial use of the Program, the Contributor who 116 | includes the Program in a commercial product offering should do so in a 117 | manner which does not create potential liability for other Contributors. 118 | Therefore, if a Contributor includes the Program in a commercial product 119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend 120 | and indemnify every other Contributor ("Indemnified Contributor") against any 121 | losses, damages and costs (collectively "Losses") arising from claims, 122 | lawsuits and other legal actions brought by a third party against the 123 | Indemnified Contributor to the extent caused by the acts or omissions of such 124 | Commercial Contributor in connection with its distribution of the Program in 125 | a commercial product offering. The obligations in this section do not apply 126 | to any claims or Losses relating to any actual or alleged intellectual 127 | property infringement. In order to qualify, an Indemnified Contributor must: 128 | a) promptly notify the Commercial Contributor in writing of such claim, and 129 | b) allow the Commercial Contributor tocontrol, and cooperate with the 130 | Commercial Contributor in, the defense and any related settlement 131 | negotiations. The Indemnified Contributor may participate in any such claim 132 | at its own expense. 133 | 134 | For example, a Contributor might include the Program in a commercial product 135 | offering, Product X. That Contributor is then a Commercial Contributor. If 136 | that Commercial Contributor then makes performance claims, or offers 137 | warranties related to Product X, those performance claims and warranties are 138 | such Commercial Contributor's responsibility alone. Under this section, the 139 | Commercial Contributor would have to defend claims against the other 140 | Contributors related to those performance claims and warranties, and if a 141 | court requires any other Contributor to pay any damages as a result, the 142 | Commercial Contributor must pay those damages. 143 | 144 | 5. NO WARRANTY 145 | 146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON 147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER 148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR 149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A 150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the 151 | appropriateness of using and distributing the Program and assumes all risks 152 | associated with its exercise of rights under this Agreement , including but 153 | not limited to the risks and costs of program errors, compliance with 154 | applicable laws, damage to or loss of data, programs or equipment, and 155 | unavailability or interruption of operations. 156 | 157 | 6. DISCLAIMER OF LIABILITY 158 | 159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY 160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, 161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION 162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE 165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY 166 | OF SUCH DAMAGES. 167 | 168 | 7. GENERAL 169 | 170 | If any provision of this Agreement is invalid or unenforceable under 171 | applicable law, it shall not affect the validity or enforceability of the 172 | remainder of the terms of this Agreement, and without further action by the 173 | parties hereto, such provision shall be reformed to the minimum extent 174 | necessary to make such provision valid and enforceable. 175 | 176 | If Recipient institutes patent litigation against any entity (including a 177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself 178 | (excluding combinations of the Program with other software or hardware) 179 | infringes such Recipient's patent(s), then such Recipient's rights granted 180 | under Section 2(b) shall terminate as of the date such litigation is filed. 181 | 182 | All Recipient's rights under this Agreement shall terminate if it fails to 183 | comply with any of the material terms or conditions of this Agreement and 184 | does not cure such failure in a reasonable period of time after becoming 185 | aware of such noncompliance. If all Recipient's rights under this Agreement 186 | terminate, Recipient agrees to cease use and distribution of the Program as 187 | soon as reasonably practicable. However, Recipient's obligations under this 188 | Agreement and any licenses granted by Recipient relating to the Program shall 189 | continue and survive. 190 | 191 | Everyone is permitted to copy and distribute copies of this Agreement, but in 192 | order to avoid inconsistency the Agreement is copyrighted and may only be 193 | modified in the following manner. The Agreement Steward reserves the right to 194 | publish new versions (including revisions) of this Agreement from time to 195 | time. No one other than the Agreement Steward has the right to modify this 196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The 197 | Eclipse Foundation may assign the responsibility to serve as the Agreement 198 | Steward to a suitable separate entity. Each new version of the Agreement will 199 | be given a distinguishing version number. The Program (including 200 | Contributions) may always be distributed subject to the version of the 201 | Agreement under which it was received. In addition, after a new version of 202 | the Agreement is published, Contributor may elect to distribute the Program 203 | (including its Contributions) under the new version. Except as expressly 204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or 205 | licenses to the intellectual property of any Contributor under this 206 | Agreement, whether expressly, by implication, estoppel or otherwise. All 207 | rights in the Program not expressly granted under this Agreement are 208 | reserved. 209 | 210 | This Agreement is governed by the laws of the State of New York and the 211 | intellectual property laws of the United States of America. No party to this 212 | Agreement will bring a legal action under this Agreement more than one year 213 | after the cause of action arose. Each party waives its rights to a jury trial 214 | in any resulting litigation. 215 | -------------------------------------------------------------------------------- /language-helloworlds/clojure/README.md: -------------------------------------------------------------------------------- 1 | # hello 2 | 3 | A Clojure library designed to ... well, that part is up to you. 4 | 5 | ## Usage 6 | 7 | FIXME 8 | 9 | ## License 10 | 11 | Copyright © 2014 FIXME 12 | 13 | Distributed under the Eclipse Public License either version 1.0 or (at 14 | your option) any later version. 15 | -------------------------------------------------------------------------------- /language-helloworlds/clojure/doc/intro.md: -------------------------------------------------------------------------------- 1 | # Introduction to hello 2 | 3 | TODO: write [great documentation](http://jacobian.org/writing/what-to-write/) 4 | -------------------------------------------------------------------------------- /language-helloworlds/clojure/project.clj: -------------------------------------------------------------------------------- 1 | (defproject hello "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :dependencies [[org.clojure/clojure "1.6.0"]] 7 | :main hello.helloworld) 8 | -------------------------------------------------------------------------------- /language-helloworlds/clojure/src/hello/helloworld.clj: -------------------------------------------------------------------------------- 1 | (ns hello.helloworld) 2 | 3 | (defn -main 4 | [& args] 5 | (println "Hello, World!")) -------------------------------------------------------------------------------- /language-helloworlds/clojure/test/hello/core_test.clj: -------------------------------------------------------------------------------- 1 | (ns hello.core-test 2 | (:require [clojure.test :refer :all] 3 | [hello.core :refer :all])) 4 | 5 | (deftest a-test 6 | (testing "FIXME, I fail." 7 | (is (= 0 1)))) 8 | -------------------------------------------------------------------------------- /language-helloworlds/dockerfile/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:centos6 2 | 3 | # Enable EPEL for Node.js 4 | RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm 5 | # Install Node.js and npm 6 | RUN yum install -y npm 7 | 8 | # Bundle app source 9 | COPY . /src 10 | # Install app dependencies 11 | RUN cd /src; npm install 12 | 13 | EXPOSE 8080 14 | CMD ["node", "/src/index.js"] -------------------------------------------------------------------------------- /language-helloworlds/dockerfile/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | 3 | // Constants 4 | var PORT = 8080; 5 | 6 | // App 7 | var app = express(); 8 | app.get('/', function (req, res) { 9 | res.send('Hello world\n'); 10 | }); 11 | 12 | app.listen(PORT); 13 | console.log('Running on http://localhost:' + PORT); -------------------------------------------------------------------------------- /language-helloworlds/dockerfile/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker-centos-hello", 3 | "private": true, 4 | "version": "0.0.1", 5 | "description": "Node.js Hello world app on CentOS using docker", 6 | "author": "Daniel Gasienica ", 7 | "dependencies": { 8 | "express": "3.2.4" 9 | } 10 | } -------------------------------------------------------------------------------- /language-helloworlds/fig/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | ENV PYTHONUNBUFFERED 1 3 | RUN mkdir /code 4 | WORKDIR /code 5 | ADD requirements.txt /code/ 6 | RUN pip install -r requirements.txt 7 | ADD . /code/ -------------------------------------------------------------------------------- /language-helloworlds/fig/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/language-helloworlds/fig/db.sqlite3 -------------------------------------------------------------------------------- /language-helloworlds/fig/fig.yml: -------------------------------------------------------------------------------- 1 | db: 2 | image: postgres 3 | web: 4 | build: . 5 | command: python manage.py runserver 0.0.0.0:8000 6 | volumes: 7 | - .:/code 8 | ports: 9 | - "8000:8000" 10 | links: 11 | - db -------------------------------------------------------------------------------- /language-helloworlds/fig/figexample/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/language-helloworlds/fig/figexample/__init__.py -------------------------------------------------------------------------------- /language-helloworlds/fig/figexample/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/language-helloworlds/fig/figexample/__init__.pyc -------------------------------------------------------------------------------- /language-helloworlds/fig/figexample/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for figexample project. 3 | 4 | For more information on this file, see 5 | https://docs.djangoproject.com/en/1.7/topics/settings/ 6 | 7 | For the full list of settings and their values, see 8 | https://docs.djangoproject.com/en/1.7/ref/settings/ 9 | """ 10 | 11 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 12 | import os 13 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 14 | 15 | 16 | # Quick-start development settings - unsuitable for production 17 | # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ 18 | 19 | # SECURITY WARNING: keep the secret key used in production secret! 20 | SECRET_KEY = 'mnx1h-z=dt^4gjt(-)k%d9=#njqu1xa1tisc0k5bc6grbgf-g9' 21 | 22 | # SECURITY WARNING: don't run with debug turned on in production! 23 | DEBUG = True 24 | 25 | TEMPLATE_DEBUG = True 26 | 27 | ALLOWED_HOSTS = [] 28 | 29 | 30 | # Application definition 31 | 32 | INSTALLED_APPS = ( 33 | 'django.contrib.admin', 34 | 'django.contrib.auth', 35 | 'django.contrib.contenttypes', 36 | 'django.contrib.sessions', 37 | 'django.contrib.messages', 38 | 'django.contrib.staticfiles', 39 | ) 40 | 41 | MIDDLEWARE_CLASSES = ( 42 | 'django.contrib.sessions.middleware.SessionMiddleware', 43 | 'django.middleware.common.CommonMiddleware', 44 | 'django.middleware.csrf.CsrfViewMiddleware', 45 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 46 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 47 | 'django.contrib.messages.middleware.MessageMiddleware', 48 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 49 | ) 50 | 51 | ROOT_URLCONF = 'figexample.urls' 52 | 53 | WSGI_APPLICATION = 'figexample.wsgi.application' 54 | 55 | 56 | # Database 57 | # https://docs.djangoproject.com/en/1.7/ref/settings/#databases 58 | 59 | DATABASES = { 60 | 'default': { 61 | 'ENGINE': 'django.db.backends.sqlite3', 62 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 63 | 'USER': 'postgres', 64 | 'HOST': 'db', 65 | 'PORT': 5432, 66 | } 67 | } 68 | 69 | # Internationalization 70 | # https://docs.djangoproject.com/en/1.7/topics/i18n/ 71 | 72 | LANGUAGE_CODE = 'en-us' 73 | 74 | TIME_ZONE = 'UTC' 75 | 76 | USE_I18N = True 77 | 78 | USE_L10N = True 79 | 80 | USE_TZ = True 81 | 82 | 83 | # Static files (CSS, JavaScript, Images) 84 | # https://docs.djangoproject.com/en/1.7/howto/static-files/ 85 | 86 | STATIC_URL = '/static/' 87 | -------------------------------------------------------------------------------- /language-helloworlds/fig/figexample/settings.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/language-helloworlds/fig/figexample/settings.pyc -------------------------------------------------------------------------------- /language-helloworlds/fig/figexample/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, include, url 2 | from django.contrib import admin 3 | 4 | urlpatterns = patterns('', 5 | # Examples: 6 | # url(r'^$', 'figexample.views.home', name='home'), 7 | # url(r'^blog/', include('blog.urls')), 8 | 9 | url(r'^admin/', include(admin.site.urls)), 10 | ) 11 | -------------------------------------------------------------------------------- /language-helloworlds/fig/figexample/urls.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/language-helloworlds/fig/figexample/urls.pyc -------------------------------------------------------------------------------- /language-helloworlds/fig/figexample/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for figexample project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "figexample.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /language-helloworlds/fig/figexample/wsgi.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domeide/sublime-docker/7ec2ee79bd32003b4df6c95e21ac245546ac4eb7/language-helloworlds/fig/figexample/wsgi.pyc -------------------------------------------------------------------------------- /language-helloworlds/fig/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "figexample.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /language-helloworlds/fig/requirements.txt: -------------------------------------------------------------------------------- 1 | Django 2 | psycopg2 -------------------------------------------------------------------------------- /language-helloworlds/go-version.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | ) 7 | 8 | func main() { 9 | fmt.Printf("Hello world from Go - " + runtime.Version() + "\n") 10 | } 11 | 12 | -------------------------------------------------------------------------------- /language-helloworlds/javarun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #set -x 4 | 5 | java=$1 6 | class=${java%.java} 7 | class=${class##*/} 8 | 9 | javac ${java} 10 | 11 | cd /src 12 | ls -altr ${class}.class 13 | java -cp . ${class} 14 | 15 | -------------------------------------------------------------------------------- /language-helloworlds/perl-version.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | print "Hello World from Perl (5 or 6 ?!)\n"; 4 | 5 | -------------------------------------------------------------------------------- /language-helloworlds/perl6-only.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | print "Hello World from Perl (5 or 6 ?!)\n"; 4 | 5 | say "7 is prime" if 7.Int.is-prime 6 | -------------------------------------------------------------------------------- /language-helloworlds/python-version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | 5 | print("Hello World - from Python " + sys.version) 6 | 7 | -------------------------------------------------------------------------------- /language-helloworlds/rubyversion.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | puts "Hello World from Ruby " + RUBY_VERSION 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/sublime_docker_tests.py: -------------------------------------------------------------------------------- 1 | import sublime, sublime_plugin 2 | import time 3 | 4 | hello_dir="/Users/mariolet/GitHub/sublime-docker/language-helloworlds/" 5 | hello_java="HelloWorld.java" 6 | hello_cpp="HelloWorld.cpp" 7 | hello_perl="perl-version.pl" 8 | hello_perl6="perl6-only.pl" 9 | hello_python="python-version.py" 10 | hello_ruby="rubyversion.rb" 11 | hello_go="go-version.go" 12 | 13 | args_default_python={"type": "RUN", "docker_image": "python", "docker_image_tag": "latest", "docker_image_exe": "python"} 14 | args_default_ruby={"type": "RUN", "docker_image": "ruby", "docker_image_tag": "latest", "docker_image_exe": "ruby"} 15 | args_default_go={"type": "RUN", "docker_image": "golang", "docker_image_tag": "latest", "docker_image_exe": "go run"} 16 | args_default_perl={"type": "RUN", "docker_image": "perl", "docker_image_tag": "latest", "docker_image_exe": "perl"} 17 | args_default_cpp={"type": "RUN", "docker_image": "gcc", "docker_image_tag": "latest", "docker_image_exe": "g++"} 18 | args_default_java={"type": "RUN", "docker_image": "java", "docker_image_tag": "latest"} 19 | 20 | 21 | class SublimeDockerTestsCommand(sublime_plugin.WindowCommand): 22 | 23 | def run(self): 24 | self.test_python() 25 | time.sleep(1) 26 | self.test_ruby() 27 | time.sleep(1) 28 | self.test_golang() 29 | time.sleep(1) 30 | self.test_java() 31 | time.sleep(1) 32 | self.test_cpp() 33 | time.sleep(1) 34 | self.test_perl() 35 | 36 | def test_python(self): 37 | self.window.open_file(hello_dir+hello_python) 38 | self.window.run_command("docker_build",args_default_python) 39 | 40 | def test_ruby(self): 41 | self.window.open_file(hello_dir+hello_ruby) 42 | self.window.run_command("docker_build",args_default_ruby) 43 | 44 | def test_golang(self): 45 | self.window.open_file(hello_dir+hello_go) 46 | self.window.run_command("docker_build",args_default_go) 47 | 48 | def test_java(self): 49 | self.window.open_file(hello_dir+hello_java) 50 | self.window.run_command("docker_build",args_default_java) 51 | 52 | def test_cpp(self): 53 | self.window.open_file(hello_dir+hello_cpp) 54 | self.window.run_command("docker_build",args_default_cpp) 55 | 56 | def test_perl(self): 57 | self.window.open_file(hello_dir+hello_perl) 58 | self.window.run_command("docker_build",args_default_perl) 59 | 60 | --------------------------------------------------------------------------------