diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d4adda1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:latest + +MAINTAINER myenigmamachine + +COPY . /src +WORKDIR /src + +RUN npm install +RUN npm run build + +EXPOSE 8080 + +CMD npm run start diff --git a/src/behaviors/change-color.js b/app/behaviors/change-color.js similarity index 100% rename from src/behaviors/change-color.js rename to app/behaviors/change-color.js diff --git a/src/index.js b/app/index.js similarity index 100% rename from src/index.js rename to app/index.js diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2412b99 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,4 @@ +web: + build: . + ports: + - "8080:8080" diff --git a/package.json b/package.json index 613a481..2dcc9bb 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "author": "", "devDependencies": { "babel-core": "^6.2.1", - "babel-loader": "^6.2.0", + "babel-loader": "^6.2.4", "babel-preset-es2015": "^6.1.18", "babel-preset-stage-1": "^6.1.18", "css-loader": "^0.23.1", @@ -20,12 +20,14 @@ "eslint-config-airbnb": "^6.2.0", "eslint-plugin-react": "^4.2.3", "style-loader": "^0.13.0", - "webpack": "^1.12.9", - "webpack-dev-server": "^1.14.0" + "html-webpack-plugin": "^2.15.0", + "webpack": "^1.12.14", + "webpack-dev-server": "^1.14.1" }, "dependencies": { "altspace": "^0.6.0", "three": "^0.73.0", - "pleasejs": "^0.4.2" + "pleasejs": "^0.4.2", + "express": "^4.13.4" } } diff --git a/server.js b/server.js new file mode 100644 index 0000000..13f90ea --- /dev/null +++ b/server.js @@ -0,0 +1,38 @@ +// Copyright 2015-2016, Google, Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +var express = require('express'); + +var app = express(); + +// Setup view engine +app.set('view engine', 'jade'); + +app.use(express.static(__dirname + '/dist')); + +app.get('/', function(req, res) { + res.render('index'); +}); + +var server = app.listen( + process.env.PORT || 8080, + '0.0.0.0', + function () { + var address = server.address().address; + var port = server.address().port; + console.log('App listening at http://%s:%s', address, port); + console.log('Press Ctrl+C to quit.'); + } +); diff --git a/webpack.config.js b/webpack.config.js index 70f73f3..cb60389 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,17 +1,24 @@ +var HtmlWebpackPlugin = require('html-webpack-plugin'); +var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({ + template: 'index.html', + filename: 'index.html', + inject: 'body' +}); + module.exports = { entry: [ - './src/index.js' + './app/index.js' ], output: { path: __dirname, - publicPath: '/', - filename: 'bundle.js' + publicPath: '/dist', + filename: 'index_bundle.js' }, module: { loaders: [{ test: /\.jsx?$/, exclude: /node_modules/, - loaders: ['babel'] + loaders: ['babel-loader'] }, { test: /\.css$/, loader: 'style!css' @@ -23,5 +30,6 @@ module.exports = { devServer: { historyApiFallback: true, contentBase: './' - } + }, + plugins: [HTMLWebpackPluginConfig] }