Created
April 14, 2015 21:50
-
-
Save rksm/270ba294eccb4e687dec to your computer and use it in GitHub Desktop.
docker setup for clojure / cloxp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM dockerfile/nodejs | |
MAINTAINER Robert Krahn <[email protected]> | |
USER root | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update | |
RUN apt-get install -y \ | |
python-software-properties \ | |
curl wget git \ | |
less manpages manpages-dev \ | |
openssh-server openssh-client sudo \ | |
lsof dnsutils aspell bzip2 unzip zip | |
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
# java...! | |
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list | |
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list | |
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 | |
RUN apt-get update | |
# auto accept oracle jdk license | |
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections | |
RUN apt-get install -y oracle-java8-installer ca-certificates | |
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle | |
RUN apt-get -y install maven | |
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
RUN /usr/sbin/useradd \ | |
--create-home --home-dir /home/lively \ | |
--shell /bin/bash \ | |
--groups sudo \ | |
--password niHEcdDiD3J1o \ | |
lively | |
# git | |
ADD gitconfig /home/lively/.gitconfig | |
# nodejs tooling | |
RUN npm install forever -g | |
# lively | |
ENV WORKSPACE_LK /home/lively/cloxp/LivelyKernel | |
ENV HOME /home/lively | |
USER lively | |
ADD gitconfig /home/lively/.gitconfig | |
RUN mkdir /home/lively/bin | |
ENV PATH $HOME/bin:$PATH | |
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
WORKDIR /home/lively/cloxp/LivelyKernel | |
# default clojure nREPL port | |
# + Lively runs here | |
EXPOSE 10080 | |
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
# cloxp specific workspace setup | |
ENV CLOJURE_FEATHER $HOME/cloxp/clj-feather | |
ENV PATH $CLOJURE_FEATHER:$PATH | |
RUN mkdir -p /home/lively/bin; \ | |
cd /home/lively/bin; \ | |
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein; \ | |
chmod a+x lein; \ | |
./lein | |
CMD rm *.pid; \ | |
forever bin/lk-server.js -p 10080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /home/lively/lively-web.org/cloxp | |
port=${1-10080} | |
logs=$PWD/logs | |
ts=`date "+%Y-%m-%d_%M-%H-%S"` | |
logfile="~/logs/$ts-$port-lively.log"; | |
container_name=cloxp-base | |
clojure_project_dir=$PWD/clojure | |
cloxp_dir=$PWD/cloxp | |
m2=$PWD/m2 | |
# lively_project_dir=$cloxp_dir/LivelyKernel | |
# [ -z "$(docker ps -a | grep $container_name)" ] && \ | |
# docker build --rm -t cloxp-base . | |
# -v $lively_project_dir:/home/lively/LivelyKernel \ | |
echo -e "Starting cloxp container on port $port" | |
echo -e "Logs are at: $logfile" | |
docker run \ | |
--name="cloxp-$port" \ | |
-v $clojure_project_dir:/home/lively/clojure \ | |
-v $cloxp_dir:/home/lively/cloxp \ | |
-v $logs:/home/lively/logs \ | |
-v $m2:/home/lively/.m2 \ | |
-p $port:10080 \ | |
-t \ | |
--detach=true \ | |
$container_name \ | |
/bin/bash --login -c "touch $logfile; forever bin/lk-server.js -p 10080 --db-config '{\"enableRewriting\":false}' | tee $logfile" | |
# $container_name /bin/bash --login | |
# docker run -it /bin/bash cloxp-base--login | |
# echo "[$(date -R)] Docker exited with $?" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment