From 625a6d2048f51b5b1700bf256c452a093f6ce6f9 Mon Sep 17 00:00:00 2001
From: Philippe Coval
Date: Mon, 23 Jul 2018 17:23:46 +0200
Subject: [PATCH] build: Add run.sh helper script for docker
Just shared as demo May be changed
Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: https://github.com/mapbox/node-sqlite3/issues/418
Forwarded: https://github.com/mapbox/node-sqlite3/pull/1112
https://github.com/mapbox/node-sqlite3/pull/1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval
---
.dockerignore | 24 ++++++++++++++++
Dockerfile | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+)
create mode 100644 .dockerignore
create mode 100755 Dockerfile
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..beddf51e3
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,24 @@
+*~
+Dockerfile
+.git/
+tmp/
+
+#{ [[./.gitignore]]
+# Standard artifacts
+*.swp
+.DS_Store
+.nyc_output/
+.cache-loader/
+
+# Build artifacts
+/build
+node_modules/
+static/js/lib/stm_web.min.js
+
+# Run-time artifacts
+.node-persist/
+config/local.js
+static/uploads
+.post_upgrade_complete
+/browser-test-output
+#} [[./.gitignore]]
diff --git a/Dockerfile b/Dockerfile
new file mode 100755
index 000000000..c14d98946
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,76 @@
+#!/bin/echo docker build . -f
+# -*- coding: utf-8 -*-
+#{
+# ISC License
+# Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
+# Copyright (c) 1995-2003 by Internet Software Consortium
+# Permission to use, copy, modify, and /or distribute this software
+# for any purpose with or without fee is hereby granted,
+# provided that the above copyright notice
+# and this permission notice appear in all copies.
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS.
+# IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
+# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION,
+# ARISING OUT OF OR IN CONNECTION WITH THE USE
+# OR PERFORMANCE OF THIS SOFTWARE.
+#}
+
+FROM ubuntu:latest
+MAINTAINER Philippe Coval (p.coval@samsung.com)
+
+ENV DEBIAN_FRONTEND noninteractive
+ENV LC_ALL en_US.UTF-8
+ENV LANG ${LC_ALL}
+
+RUN echo "#log: Configuring locales" \
+ && set -x \
+ && apt-get update -y \
+ && apt-get install -y locales \
+ && echo "${LC_ALL} UTF-8" | tee /etc/locale.gen \
+ && locale-gen ${LC_ALL} \
+ && dpkg-reconfigure locales \
+ && sync
+
+ENV project node-sqlite3
+
+RUN echo "#log: ${project}: Setup system" \
+ && set -x \
+ && apt-get update -y \
+ && apt-get install -y \
+ curl \
+ sudo \
+ build-essential \
+ python \
+ && apt-get clean \
+ && NVM_VERSION="v0.33.8" \
+ && NODE_VERSION="--lts=carbon" \
+ && curl -o- https://github.com/raw/creationix/nvm/${NVM_VERSION}/install.sh | bash \
+ && which nvm || . ~/.bashrc \
+ && nvm install ${NODE_VERSION} \
+ && nvm use ${NODE_VERSION} \
+ && sync
+
+ADD . /usr/local/${project}/${project}
+WORKDIR /usr/local/${project}/${project}
+RUN echo "#log: ${project}: Preparing sources" \
+ && set -x \
+ && which npm || . ~/.bashrc \
+ && npm install || cat npm-debug.log \
+ && npm install \
+ && npm install --unsafe-perm --build-from-source \
+ && sync
+
+WORKDIR /usr/local/${project}/${project}
+RUN echo "#log: ${project}: Building sources" \
+ && set -x \
+ && which npm || . ~/.bashrc \
+ && npm run pack \
+ && npm pack \
+ && find build/stage/ -type f \
+ && sync
+