Coder Social home page Coder Social logo

kscript-dockernized's Introduction

kscript-dockernized

Files to build a Docker's container in order to run Kscript with Java 8.

Build Image

Run docker build -t kscript-openjdk8 . fom the root of the source code. In this case kscript-openjdk8 is image name, you can change it whatever you want.

Run scripts with container

  • For inline function: docker run -i --rm kscript-openjdk8 'println("Hello Kotlin")'.
  • For a *.kts scripts: docker run -i --rm kscript-openjdk8 script.kts.

Notes:

  • -i is docker run's option stands for interaction which is used in this case for accept input (println("Hello Kotlin") is an input) into container.
  • --rm is docker run's option which mean remove container after done run it.

Some docker run's options will help in case you want to run it more effectively:

  • -v [MOUNT]:[PATH_TO_CONTAINER_DIRECTORY]: bind a mount with [MOUNT] name to the [PATH_TO_CONTAINER_DIRECTORY]. Useful for cache kscript compiled dependencies.
  • -v [PATH_TO_SOURCE_CODE]:[PATH_TO_CONTAINER_DIRECTORY]: set [PATH_TO_CONTAINER_DIRECTORY] sync with [PATH_TO_CONTAINER_DIRECTORY] so changes from your source code on the host system can sync with docker container.
  • --env-file: read an environment file. Useful when you want docker container reads some specific environment's variables like database conection... .

The source code includes a shell script kscript which run an already built image tronglehs/kscript-openjdk8 using this source code Dockerfile. The script comes with:

  • docker run's options in order to cache kscript's compiled dependencies (which are sit on /root/.m2, /root/.kscript by default), and sync the files between host system and docker container.
  • Read an .env file. You can run (from the source code's root): ./kscript your-script.kts.

Credits

kscript-dockernized's People

Contributors

trongle avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.