Initial commit

This commit is contained in:
Yuriy Glukhov 2018-03-14 19:58:58 +02:00
parent f3b34c6b15
commit d7b0ce3228
6 changed files with 89 additions and 2 deletions

5
.travis.yml Normal file
View File

@ -0,0 +1,5 @@
sudo: required
services:
- docker
script:
- docker login "--password=$DOCKER_PASS" "--username=$DOCKER_USER" && ./build.sh && docker logout

View File

@ -1,2 +1,14 @@
# nim-docker
Nim docker images used to build Status nim projects
# nim-docker [![Build Status](https://travis-ci.org/status-im/nim-docker.svg?branch=master)](https://travis-ci.org/status-im/nim-docker)
This is a helper repo for auto building docker image with latest [Nim](https://github.com/nim-lang/Nim) devel version. In order to setup [Travis CI](https://travis-ci.org) for your project using this image, copy the following lines to your `.travis.yml` file in the root of your repository:
```yml
sudo: required
services:
- docker
before_install:
- docker pull statusteam/nim-base
script:
- docker run statusteam/nim-base nim --version
- docker run -v "$(pwd):/project" -w /project statusteam/nim-base nimble test
```
Also make sure to enable your project in [Travis CI](https://travis-ci.org). This configuration will run `nimble test` in the root of your repository.

14
build.sh Executable file
View File

@ -0,0 +1,14 @@
set -ev
buildAndPush() {
docker build -t statusteam/$1 $1
docker push statusteam/$1
}
if [ "$1" = "all" -o "$BUILD_ALL" = "true" ]
then
buildAndPush debian-pre-nim
fi
buildAndPush nim-base

14
debian-pre-nim/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM debian:stretch
MAINTAINER Yuriy Glukhov <yuriy.glukhov@gmail.com>
ADD run.sh /bin/run
RUN while ! apt-get update; do true; done \
&& while ! apt-get install -y gcc g++ mercurial git nodejs libssl-dev; do true; done \
&& echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config \
&& mkdir /onStart.d /onQuit.d \
&& echo "CLEANUP" \
&& apt-get autoremove -y \
&& apt-get clean all \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/share/doc \
&& rm -rf /usr/share/man \
&& rm -rf /usr/share/locale

16
debian-pre-nim/run.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
for I in $(ls /onStart.d)
do
. /onStart.d/$I
done
# Run the command
sh -c "$*"
EXIT_CODE=$?
for I in $(ls /onQuit.d)
do
. /onQuit.d/$I
done
exit $EXIT_CODE

26
nim-base/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM yglukhov/debian-pre-nim
MAINTAINER Yuriy Glukhov <yuriy.glukhov@gmail.com>
ENV PATH $PATH:/nim/bin:/root/.nimble/bin
#ENV NIM_PATCH_BRANCHES my-patch
RUN git clone https://github.com/nim-lang/nim.git \
&& cd nim \
&& git remote add yglukhov https://github.com/yglukhov/nim.git \
&& git fetch yglukhov \
&& git config --global user.email "you@example.com" \
&& git config --global user.name "Your Name" \
&& for i in $NIM_PATCH_BRANCHES; do git merge yglukhov/$i; done \
&& git clone --depth 1 https://github.com/nim-lang/csources.git \
&& cd csources \
&& sh build.sh \
&& cd .. \
&& nim c koch \
&& ./koch boot -d:release \
&& ./koch nimble \
&& echo echo nim version: $(git rev-parse HEAD) > /onStart.d/005-nim-version.sh \
&& chmod +x /onStart.d/005-nim-version.sh \
&& cd ./dist/nimble \
&& echo echo nimble version: $(git rev-parse HEAD) > /onStart.d/006-nimble-version.sh \
&& chmod +x /onStart.d/006-nimble-version.sh \
&& cd ../.. \
&& rm -rf ./nimcache ./compiler/nimcache ./csources ./dist ./.git \
&& cd ..