Permalink
Browse files

Adds docker config and startup script

  • Loading branch information...
benoitlecluse authored and sagotch committed Jul 16, 2018
1 parent 2d54f19 commit fd369a2feb924ed6ec945c137e19da0e44396534
Showing with 105 additions and 1 deletion.
  1. +24 −0 Dockerfile
  2. +14 −1 README.md
  3. +67 −0 docker/build.sh
View
@@ -0,0 +1,24 @@
FROM ocaml/opam2:ubuntu-16.04-ocaml-4.06
RUN opam update
RUN eval `opam config env`
RUN opam install dune
RUN sudo apt-get update
RUN sudo apt-get install -y pkg-config libcurl4-gnutls-dev m4 protobuf-compiler
RUN mkdir geneweb
RUN mkdir bases
WORKDIR geneweb
COPY geneweb.opam .
RUN opam pin add geneweb . --no-action -y
RUN opam install geneweb --deps-only -y
EXPOSE 2317
EXPOSE 2316
WORKDIR /home/opam/geneweb/docker/
CMD bash ./build.sh
View
@@ -48,7 +48,6 @@ git clone https://github.com/geneweb/geneweb
make opt
make distrib
```
### Building the API
The API uses the Google Protocol Buffer to exchange informations
@@ -69,6 +68,20 @@ It has the following dependancies:
- yojson
- redis
### Docker
You can use Docker to build and run geneweb on any computer.
```
git clone https://github.com/geneweb/geneweb
cd geneweb
docker build -t geneweb .
docker run --rm -it -p 2316:2316 -p 2317:2317 -v `pwd`:/home/opam/geneweb/ -v YOUR_BASE_DIR:/home/opam/bases/ geneweb /home/opam/geneweb/docker/build.sh --run --api --clean
```
the following options are available for the build script :
- run: runs geneweb and gwsetup right after build
- clean: runs `make clean` before build phase
- api: builds the api
## Contributor guidelines
### Creating a pull request
View
@@ -0,0 +1,67 @@
#!/bin/bash
set -e
_show_help () {
echo "Build and run geneweb in the docker container"
echo ""
echo "USAGE"
echo "./install [--options]"
echo ""
echo "OPTIONS"
echo "--api: adds API build"
echo "--clean: cleans before build "
echo "--run: runs geneweb and gwsetup"
echo "--help: this beautiful help"
echo ""
}
WITH_API=false
WITH_CLEAN=false
WITH_RUN=false
for i in "$@"
do
case $i in
--api)
WITH_API=true
;;
--clean)
WITH_CLEAN=true
;;
--run)
WITH_RUN=true
;;
--help|-h|*)
_show_help
;;
esac
done
cd /home/opam/geneweb
if [ "$WITH_API" = true ]; then
./configure --api
else
./configure
fi
if [ "$WITH_CLEAN" = true ]; then
make clean
fi
make distrib
if [ "$WITH_RUN" = true ]; then
/sbin/ip route|awk '/default/ { print $3 }' > distribution/gw/only.txt
export BASE_DIR="/home/opam/bases/"
export BIN_DIR="/home/opam/geneweb/distribution/gw/"
$BIN_DIR/gwd -hd $BIN_DIR -bd $BASE_DIR &
cd $BASE_DIR;
$BIN_DIR/gwsetup -lang fr -gd $BIN_DIR -bindir $BIN_DIR
fi

0 comments on commit fd369a2

Please sign in to comment.