Commit 7abf80fd authored by Rurik Bugdanov's avatar Rurik Bugdanov

Add docker image

parent bb7b417c
README.txt
Makefile
FROM debian:jessie-slim
RUN apt-get update \
&& apt-get install -y \
git \
wget \
php5-cgi \
vim
RUN useradd --create-home --shell /bin/bash elphel
COPY install-nodejs.sh /tmp
USER elphel
RUN /tmp/install-nodejs.sh
WORKDIR /home/elphel
RUN cd /home/elphel \
&& git clone --single-branch -b gulp https://git.elphel.com/Elphel/x3domlet \
&& export NVM_DIR="/home/elphel/.nvm" \
&& [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" \
&& npm install -g bower gulpjs/gulp-cli \
&& cd x3domlet \
&& npm install \
&& bower install \
&& gulp build
WORKDIR /home/elphel/x3domlet
COPY docker-entrypoint.sh /home/elphel/
ENTRYPOINT ["/home/elphel/docker-entrypoint.sh"]
all: x3domlet
x3domlet:
docker build -t x3domlet .
run:
./docker-run.sh
BUILD
- Run "make" to build the docker image.
USE
- Run "docker-run.sh" from the directory containing the "/models"
and "/kml" folders you want to use. It will start the docker image
and open a browser window.
NOTE: The current user must be allowed to run docker. Otherwise use 'sudo'.
#!/bin/bash
export NVM_DIR="/home/elphel/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
exec "$@"
#!/bin/bash
docker run -i \
-v $(pwd)/../assets/models:/home/elphel/x3domlet/models \
-v $(pwd)/../assets/kml:/home/elphel/x3domlet/kml \
-p 8080:8080 \
-p 35729:35729 \
x3domlet \
gulp connect &
sleep 5
xdg-open http://localhost:8080/index.html
#!/bin/bash
set -e
echo checking for installed node version
node --version && exit
echo get latest nvm release number ...
NVM_VERSION=$(git ls-remote --tags https://github.com/creationix/nvm master v\* | sed -r -n -e 's/.*(v[0-9\.]+)$/\1/p' | sort -V | tail -n 1)
echo downloading nvm $NVM_VERSION
# download nvm installer
wget -q -O /tmp/install.sh https://raw.githubusercontent.com/creationix/nvm/$NVM_VERSION/install.sh
echo installing nvm
. /tmp/install.sh
export NVM_DIR="$HOME/.nvm"
test -s "$NVM_DIR/nvm.sh"
. "$NVM_DIR/nvm.sh"
echo get latest node LTS release number
NODE_VERSION=$(nvm ls-remote | grep LTS | tail -n 1 | sed -r -n -e 's/.*(v[0-9\.]+).*/\1/p')
echo install nodejs
nvm install $NODE_VERSION
# disable npm progress
touch $HOME/.npmrc
grep -q progress= $HOME/.npmrc || echo progress=false >> $HOME/.npmrc
echo install latest npm
npm install -g npm
echo done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment