GithubHelp home page GithubHelp logo

scala-jre8-alpine's Introduction

scala-jre8-alpine

  • A light and simple scala docker container running in alpine Linux with curl and git.
  • Alpine is a tiny linux OS.
  • This container has only jre (no jdk), it's for pure scala, doesn't support java program.
  • It's only 84M, ideally using in small scala project.

dockeri.co

Scala

Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.

Docker

Docker is a containerized system, which can run on Windows, Linux, and Mac OS. It can easily package and transfer development environments.

how to use

  1. Install Docker

  2. Pull the scala-jre8-alpine image from DockerHub

docker pull baocaifeng/scala-jre8-alpine:1.0
  1. Build image

You can also dowload Dockerfile from github and build it by yourself. To build, you need to specify the desired openjdk and scala versions via --build-arg parameters. By default, OPENJDK_TAG=8u151-jre-alpine, SCALA_VERSION=2.13.5

docker build --build-arg OPENJDK_TAG=<Your Openjdk Tag> --build-arg SCALA_VERSION=<Your Scala version> .
  1. Create container

Mount host directory to container

mkdir <Your directory>
docker container run -it -d --rm -v $PWD/<Your directory>:/mnt/code --name <Container name> baocaifeng/scala-jre8-alpine:1.0
docker ps

Work in container just like in linux as usual

docker container exec -it autocomplete "/bin/sh"
  1. Check version
git --version
scala -version
scalac -version

java -version
  • git version 2.15.4
  • Scala code runner version 2.13.5 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.
  • Scala compiler version 2.13.5 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.
  • openjdk version "1.8.0_151"
  • OpenJDK Runtime Environment (IcedTea 3.6.0) (Alpine 8.151.12-r0)
  • OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
  • Attention ! jdk is not installed, there is no javac

demo

  • In Demo.scala
import scala.io.StdIn.readLine

object Demo extends App {

    print("Enter your first name: ")
    val firstName = readLine()

    print("Enter your last name: ")
    val lastName = readLine()

    println(s"Your name is $firstName $lastName")

}
  • In container
scalac Demo.scala
scala Demo

scala-jre8-alpine's People

Contributors

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