From 49de188e39f28c03219527d166e05def0a956cfd Mon Sep 17 00:00:00 2001
From: Cole Christie <colec.mobile@gmail.com>
Date: Mon, 17 Sep 2018 12:40:42 -0700
Subject: [PATCH] Docker'ized the canvas example

---
 .dockerignore |  4 ++++
 Dockerfile    | 40 ++++++++++++++++++++++++++++++++++++++++
 README.md     | 13 +++++++++++++
 3 files changed, 57 insertions(+)
 create mode 100644 .dockerignore
 create mode 100644 Dockerfile

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..ab40bee7b
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+.*
+node_modules
+npm-debug.log
+*.sublime-project
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..0a03541a9
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,40 @@
+# This is to build a container that demos the Molstar Canvas prototype
+# Source material: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
+# Source material: https://derickbailey.com/2017/05/31/how-a-650mb-node-js-image-for-docker-uses-less-space-than-a-50mb-image/
+# Source material: https://hub.docker.com/_/node/
+
+# Use the slimed NodeJS source, yielding a space savings of 600MB (~66% of total)
+FROM node:alpine
+
+# Create app directory
+WORKDIR /usr/src/app
+
+# Install app dependencies
+# A wildcard is used to ensure both package.json AND package-lock.json AND tslint.json AND tsconfig.json are copied
+# where available (npm@5+)
+COPY *.json ./
+
+# Install all dependencies and copy results
+RUN npm install
+COPY . .
+
+# Build application and bundle results
+RUN npm run build
+COPY build/ build/
+
+# Build Canvas application and bundle results
+RUN npm run build-canvas
+COPY build/ build/
+
+# Open ports for HTTP
+EXPOSE 8080/tcp
+
+# Setup standalone simple webserver to run the demo
+RUN npm install http-server -g
+
+# Start NodeJS at container stand up
+CMD [ "http-server", "build/canvas/", "-p", "8080" ]
+
+# Developer helpers (what is inside this container?)
+RUN node -v
+RUN ls -alh
diff --git a/README.md b/README.md
index 97489da48..dde6fcb35 100644
--- a/README.md
+++ b/README.md
@@ -78,6 +78,19 @@ From the root of the project:
 
 and navigate to `build/viewer`
 
+
+**Run via Docker**
+
+Build the docker image
+
+    docker build -t molstar-proto .
+
+Run the image
+
+    docker run -p 8080:8080 molstar-proto
+
+
+
 ### Code generation
 **CIF schemas**
 
-- 
GitLab