Skip to content

moigagoo/nimage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to Nim

Docker Pulls

Nim is a statically typed, imperative programming language that tries to give the programmer ultimate power without compromises on runtime efficiency. This means it focuses on compile-time mechanisms in all their various forms.

Beneath a nice infix/indentation based syntax with a powerful (AST based, hygienic) macro system lies a semantic model that supports a soft realtime GC on thread local heaps. Asynchronous message passing is used between threads, so no "stop the world" mechanism is necessary. An unsafe shared memory heap is also provided for the increased efficiency that results from that model.

Tags

Tags indicate Nim versions, base images, and flavors. For example, nimlang/nim:0.16.0-ubuntu-regular means Nim version 0.16.0, based on Ubuntu, with Nimble installed. Ubuntu is the default base, so you can omit it in the tag: nimlang/nim:0.16.0-regular. Regular is the default flavor, so you can omit it as well: nimlang/nim:0.16.0. The latest Nim version is additionally tagged as latest: nimlang/nim:latest. And since Docker adds latest automatically, you can just write nimlang/nim.

So, all together:

nimlang/nim = nimlang/nim:latest = nimlang/nim:0.16.0 = nimlang/nim:0.16.0-ubuntu =nimlang/nim:latest-ubuntu = nimlang/nim:0.16.0-regular = nimlang/nim:latest-regular = nimlang/nim:0.16.0-ubuntu-regular = nimlang/nim:latest-ubuntu-regular

Phew, that's one long list! Fortunately, unless you need a specific version of Nim, you'll probably need just nimlang/nim, nimlang/nim:alpine, or nimlang/nim:onbuild.

Should you want to install a devel branch of the nim compiler or manage multiple nim version we have a nimlang/choosenim image, which provides choosenim. choosenim is a tool designed for managing your nim installation, read more here.

Bases

There are currently two bases for nimlang/nim images: Ubuntu and Alpine. Ubuntu is the default one.

The nimlang/choosenim image is based on bitnami/minideb.

Flavors

nimlang/nim images come in three flavors: slim, regular, and onbuild. Slim images include only the Nim compiler. Regular images include the compiler and Nimble package manager. Onbuild images are meant to be used in Dockerfiles for Nimble packages.

Using the Images

Get the Latest Version

$ docker pull nimlang/nim
$ docker pull nimlang/choosenim

Compiling a Single File

$ docker run --rm -v `pwd`:/usr/src/app -w /usr/src/app nimlang/nim nim c -r myapp.nim

Compiling a Static Single File

$ docker run --rm -v `pwd`:/usr/src/app -w /usr/src/app nimlang/nim:alpine nim c --passL:"-static -no-pie" myapp.nim

Building a Nimble Package

Create a Dockerfile in the package root:

FROM nimlang/nim:onbuild
ENTRYPOINT ["./mycompiledbinary"]

Build your image and run the compiled binary:

$ docker build -t myapp .
$ docker run --rm myapp