-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from uci-soe/docker
Docker
- Loading branch information
Showing
9 changed files
with
124 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/coverage | ||
/node_modules | ||
/test | ||
/tmp | ||
|
||
.dockerid | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.travis.yml | ||
docker-rebuild | ||
Dockerfile | ||
LICENSE | ||
README.md | ||
/tmp* | ||
/scratch.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ coverage | |
config.json | ||
pm2.json | ||
/tmp | ||
.dockerid |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ language: node_js | |
node_js: | ||
- v4 | ||
- v5 | ||
- v6 | ||
env: | ||
- CXX=g++-4.8 | ||
before_install: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM ubuntu:14.04 | ||
|
||
MAINTAINER Rhett Lowe <rng2ml@gmail.com> | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
RUN sed 's/main$/main universe/' -i /etc/apt/sources.list | ||
RUN apt-get update | ||
RUN apt-get upgrade -y | ||
RUN apt-get install -y curl build-essential wget | ||
|
||
# Download and install wkhtmltopdf | ||
RUN apt-get install -y xorg libssl-dev libxrender-dev gdebi xvfb libicu52 xfonts-75dpi | ||
RUN wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz | ||
RUN tar -xvJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz -C /usr/local/ | ||
ENV PATH /usr/local/wkhtmltox/bin:$PATH | ||
|
||
# Install Nodejs | ||
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash | ||
RUN apt-get install -y nodejs | ||
RUN npm install --global npm | ||
|
||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
COPY package.json /usr/src/app/ | ||
run npm install | ||
|
||
copy . /usr/src/app | ||
|
||
EXPOSE 8080 | ||
CMD [ "npm", "start" ] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
IDS=$(docker ps --all --no-trunc | grep Exited | awk '{print $1}') | ||
for ID in ${IDS}; do | ||
docker rm ${ID} | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
ID_FILE='./.dockerid' | ||
ID='' | ||
|
||
if [ -s ${ID_FILE} ]; then | ||
ID=`cat ${ID_FILE}` | ||
if [[ $(docker ps --no-trunc --quiet | grep ${ID}) != '' ]]; then | ||
docker stop ${ID} | ||
docker rm ${ID} | ||
fi | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
USER='rhettl' | ||
NAME='toPdf' | ||
TAG='node-wkhtmltopdf' | ||
ID_FILE='./.dockerid' | ||
|
||
PORT=8080 | ||
if [[ ${1} != '' ]]; then | ||
if [[ ${1} =~ ^[0-9]+$ ]] && [ ${1} -gt 0 ]; then | ||
PORT=${1} | ||
else | ||
(>&2 echo "port is not a number > 0") | ||
echo | ||
echo "USAGE: docker-rebuild [port]" | ||
echo "port defaults to 8080" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
./docker-kill | ||
|
||
docker build -t "${USER}/${TAG}" . | ||
ID=`docker run -d -p "${PORT}":8080 -e PORT=8080 --name "${NAME}" "${USER}/${TAG}"` | ||
|
||
echo ${ID} > ${ID_FILE} |
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