docker: add a README
[nit.git] / misc / docker / README.md
1 # Supported tags and respective Dockerfile links
2
3 * [latest](https://github.com/nitlang/nit/blob/master/misc/docker/Dockerfile)
4 * [full](https://github.com/nitlang/nit/blob/master/misc/docker/full/Dockerfile)
5
6 ## What is Nit?
7
8 Nit is an expressive language with a script-like syntax, a friendly type-system and aims at elegance, simplicity and intuitiveness.
9
10 Nit has a simple straightforward style and can usually be picked up quickly, particularly by anyone who has programmed before.
11 While object-oriented, it allows procedural styles.
12
13 More information on
14
15 * Website <http://www.nitlanguage.org>
16 * Github <https://github.com/nitlang/nit>
17 * Chatroom <https://gitter.im/nitlang/nit>
18
19 ## How to use this image
20
21 You can use these images to build then run your programs.
22
23 ### Experimenting with Nit
24
25 ~~~
26 host$ docker run -ti nitlang/nit
27 root@ce9b671dd9fc:/root/nit# nitc examples/hello_world.nit
28 root@ce9b671dd9fc:/root/nit# ./hello_world
29 hello world
30 ~~~
31
32 ### Build and Run Programs
33
34 In your Dockerfile, write something like:
35
36 ~~~Dockerfile
37 FROM nitlang/nit
38
39 # Create a workdir
40 RUN mkdir -p /root/work
41 WORKDIR /root/work
42
43 # Copy the source code in /root/work/
44 COPY . /root/work/
45
46 # Compile
47 RUN nitc src/hello.nit --dir . \
48         # Clear disk space
49         && ccache -C
50 # You can also use a Makefile or any build system you want.
51
52 # Run
53 CMD ["./hello"]
54 ~~~
55
56 Then, build and execute
57
58 ~~~
59 host$ docker build -t nithello .
60 host$ docker run --rm nithello
61 hello!
62 ~~~
63
64 See the full example at <https://github.com/nitlang/nit/blob/master/misc/docker/hello/Dockerfile>