Add alpine-nim image

This commit is contained in:
Cadey Ratio 2016-03-20 17:22:32 -07:00
parent 8999275225
commit 4ad2294060
5 changed files with 77 additions and 0 deletions

1
base/alpine-nim/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
nimcache

View File

@ -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

22
base/alpine-nim/LICENSE Normal file
View File

@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2015 James Cooper <james@bitmechanic.com>
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.

34
base/alpine-nim/README.md Normal file
View File

@ -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

View File

@ -0,0 +1 @@
echo "Hello World"