diff --git a/base/alpine-nim/.gitignore b/base/alpine-nim/.gitignore new file mode 100644 index 0000000..739a54a --- /dev/null +++ b/base/alpine-nim/.gitignore @@ -0,0 +1 @@ +nimcache diff --git a/base/alpine-nim/Dockerfile b/base/alpine-nim/Dockerfile new file mode 100644 index 0000000..73cf0c3 --- /dev/null +++ b/base/alpine-nim/Dockerfile @@ -0,0 +1,19 @@ +FROM alpine:3.3 + +ENV PATH=$PATH:/opt/Nim/bin:/root/.nimble/bin + +RUN apk update && \ + apk add libc-dev gcc curl libgcc git perl && \ + rm -rf /var/cache/apk/* + +RUN mkdir -p /opt && cd /opt && \ + curl -LO https://github.com/nim-lang/Nim/archive/v0.13.0.tar.gz && \ + tar zxf v0.13.0.tar.gz && rm -f v0.13.0.tar.gz && \ + mv Nim-0.13.0 Nim && cd Nim && \ + git clone --depth 1 git://github.com/nim-lang/csources && \ + cd csources && sh build.sh && \ + cd .. && ./bin/nim c koch && ./koch boot -d:release && \ + nim e install_nimble.nims && \ + rm -rf /opt/Nim/tests + +WORKDIR /src diff --git a/base/alpine-nim/LICENSE b/base/alpine-nim/LICENSE new file mode 100644 index 0000000..13d5ad8 --- /dev/null +++ b/base/alpine-nim/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 James Cooper + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/base/alpine-nim/README.md b/base/alpine-nim/README.md new file mode 100644 index 0000000..138dfc3 --- /dev/null +++ b/base/alpine-nim/README.md @@ -0,0 +1,34 @@ + +## Overview + +NOTE: The image has moved to: https://registry.hub.docker.com/u/coopernurse/docker-nim/ + +This is a quick attempt to get the Nim compiler and nimble package manager +bundled into a Docker image. + +The base image is Alpine Linux (see: https://registry.hub.docker.com/_/alpine/) +which keeps things slim. + +## Layout + +Nim is compiled from the latest github source and is in: `/opt/Nim` + +nimble is also compiled from source, but only the compiled binary is kept. + +`PATH` is updated to include: `/opt/Nim/bin` and `/root/.nimble/bin` so both +`nim` and `nimble` will be in the PATH by default. + +`WORKDIR` is set to `/src` so if you `-v` mount your local directory to `/src` you can run the +compiler directly without changing directory first. + +## Usage + +By using the `-v` flag with `docker run` you can use this image to compile your Nim sources without +a local Nim installation. For example, to compile and run `hello.nim` from this repo: + + docker run --rm -v `pwd`:/src coopernurse/docker-nim nim c -r --verbosity:0 hello.nim + +Or to compile to a binary: + + docker run --rm -v `pwd`:/src coopernurse/docker-nim nim c hello.nim + diff --git a/base/alpine-nim/hello.nim b/base/alpine-nim/hello.nim new file mode 100644 index 0000000..b5b6a5a --- /dev/null +++ b/base/alpine-nim/hello.nim @@ -0,0 +1 @@ +echo "Hello World"