Public Repository

Last pushed: 2 years ago
Short Description
Neuro Info eXchange (g-node.org)
Full Description

About

This is the docker repos for the NIX (Neuroscience Information eXchange) format developed by the German Neuroinformatics Node.

Usage

Three ways can be chosen

1) Go with the latest nix image and get it with docker pull and develop your project inside. (only good enough for some testing)

2) Write your own Dockerfile based on the latest nix image to build an own image with your project.

3) Write your own Dockerfile based on the latest-onbuild nix image: this will assume that in your docker build dir there are all your project files and a setup.sh and install.sh. Using the latest-onbuild will automatically run the following steps:

a) create dir `/usr/src/nix` inside the image
b) copy `setup.sh` to `/usr/src/nix` inside the image and execute it
c) copy all available files to `/usr/src/nix`
d) copy `install.sh` to `/usr/src/nix` inside the image and execute it

Thus you must supply setup.sh and install.sh. setup.sh should install all dependencies while install.sh should build and install your nix project. The great advantage of this is that your Dockerfile can look as simple as FROM nix:latest-onbuild. Complete example below.

Example

How to build your own NIX project using latest-onbuild - assume you have a project with the following files:

Dockerfile

FROM balint42/nix:latest-onbuild

Makefile

CC      = g++
CFLAGS  = -std=c++11
# IMPORTANT: the "-lnix" option is needed to compile !!!
LIBS    = nix
RM      = rm -f

default: all
all: mynix
mynix: main.cpp
    $(CC) $(CFLAGS) main.cpp -o mynix -l$(LIBS)
clean veryclean:
    $(RM) mynix

setup.sh

#!/bin/sh
apt-get update  # To get the latest package lists
apt-get install wget -y # if your project would need wget

install.sh

#!/bin/sh
make
ln -s ./mynix ~/bin

main.cpp

#include <nix.hpp>
#include <iostream>

int main(void) {
    nix::File file = nix::File::open("foo.h5", nix::FileMode::Overwrite);
    nix::Section section = file.createSection("foo_section", "metadata");
    std::cout << "created section " << section.name() << std::endl;
    nix::Block block = file.createBlock("foo_block", "dataset");
    std::cout << "created block " << block.name() << std::endl;
    return 0;
}

Now in your project dir simply run sudo docker build -t myuser/mynix.

That's it! Now you have a docker image myuser/mynix which contains your project under /usr/src/nix and nix under /opt/nix.

Docker Pull Command
Owner
balint42

Comments (0)