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

Add docker image

parent bb7b417c
FROM debian:jessie-slim
RUN apt-get update \
&& apt-get install -y \
git \
wget \
php5-cgi \
RUN useradd --create-home --shell /bin/bash elphel
COPY /tmp
USER elphel
RUN /tmp/
WORKDIR /home/elphel
RUN cd /home/elphel \
&& git clone --single-branch -b gulp \
&& export NVM_DIR="/home/elphel/.nvm" \
&& [ -s "$NVM_DIR/" ] && . "$NVM_DIR/" \
&& npm install -g bower gulpjs/gulp-cli \
&& cd x3domlet \
&& npm install \
&& bower install \
&& gulp build
WORKDIR /home/elphel/x3domlet
COPY /home/elphel/
ENTRYPOINT ["/home/elphel/"]
all: x3domlet
docker build -t x3domlet .
- Run "make" to build the docker image.
- Run "" 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'.
export NVM_DIR="/home/elphel/.nvm"
[ -s "$NVM_DIR/" ] && . "$NVM_DIR/"
exec "$@"
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
set -e
echo checking for installed node version
node --version && exit
echo get latest nvm release number ...
NVM_VERSION=$(git ls-remote --tags 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/$NVM_VERSION/
echo installing nvm
. /tmp/
export NVM_DIR="$HOME/.nvm"
test -s "$NVM_DIR/"
. "$NVM_DIR/"
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