Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aethant
Last active July 29, 2016 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aethant/c298fb9dec2aaba20a47425783a07454 to your computer and use it in GitHub Desktop.
Save aethant/c298fb9dec2aaba20a47425783a07454 to your computer and use it in GitHub Desktop.
version: "2"
services:
web:
depends_on:
- mongo
environment:
NODE_ENV: development
TZ: "America/Chicago"
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- /Volumes/data:/data
- .:/home/application/mc
- /home/application/mc/node_modules
networks:
- front
- back
ports:
- "8000:8000"
expose:
- "8000"
links:
- mongo
mongodata:
image: mongo
container_name: mcmongodata
volumes:
- /data/db
entrypoint: /bin/bash
mongo:
container_name: mcmongo
image: mongo
volumes_from:
- mongodata
networks:
- back
ports:
- "27017:27017"
- "27018:27018"
expose:
- "27017"
command: --smallfiles --rest --httpinterface
networks:
front:
driver: bridge
back:
driver: bridge
FROM node:6.1
RUN groupadd -r application && useradd -r -g application application
ENV HOME=/home/application
COPY package.json $HOME/mc/
RUN chown -R application:application $HOME/* && chown -R application:application $HOME/*
RUN /bin/su application
WORKDIR $HOME/mc
RUN npm i -g webpack gulp nodemon@latest
RUN npm install
USER root
# COPY . $HOME/mc
RUN chown -R application:application $HOME/*
EXPOSE 8000
EXPOSE 27017
# RUN npm run dev
CMD ["nodemon","-L","./bin/index.js"]
import configDev from '../../webpack/webpack.dev.config';
/* ... */
if ( process.env.NODE_ENV !== 'production' ) {
const compiler = webpack( configDev );
console.log(
`==> ${emoji.get( ':fire:' )} dev mode - using webpack hot reloader`
);
app.use( require( 'webpack-dev-middleware' )( compiler, {
noInfo: true,
publicPath: configDev.output.publicPath,
inline: true,
hot: true,
headers: {
'X-Custom-Header': 'yes',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept',
},
stats: {
colors: true,
},
} ) );
app.use( require( 'webpack-hot-middleware' )( compiler ) );
} else {
app.use( express.static( '../static' ) );
}
import autoprefixer from 'autoprefixer'
import path from 'path'
import precss from 'precss'
import webpack from 'webpack'
import WebpackErrorNotificationPlugin from 'webpack-error-notification'
const host = process.env.HOST || 'localhost'
const port = process.env.PORT || 8000
const dist = path.resolve( __dirname, "../static/dist" )
const config = {
devtool: 'source-maps',
entry: {
schedule: [
path.resolve( __dirname, '../src/app/schedule/index.jsx' ),
'webpack-hot-middleware/client',
],
wall: [
path.resolve( __dirname, '../src/app/wall/index.jsx' ),
'webpack-hot-middleware/client',
],
admin: [
path.resolve( __dirname, '../src/app/admin/index.jsx' ),
'webpack-hot-middleware/client',
],
common: [ 'lodash', 'moment', 'react', ],
},
output: {
filename: `[name].js`,
chunkFilename: '[name]-[chunkhash].js',
path: dist,
publicPath: `http://${host}:${port}/static/dist/`,
},
resolve: {
extensions: [ '', '.js', '.jsx', '.scss', '.css', ],
},
lazy: false,
quiet: false,
watchOptions: {
aggregateTimeout: 300,
poll: 1000,
},
progress: false,
module: {
preLoaders: [
{
test: /\.jsx$/,
loader: 'eslint',
exclude: /node_modules/,
},
],
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: [ 'babel', ],
},
{
test: /\.scss$/,
loaders: [ 'style', 'css', 'postcss', 'sass', ],
},
{
test: /\.css$/,
loaders: [ 'style', 'css', 'postcss', ],
},
],
},
postcss: () => [ precss, autoprefixer, ],
eslint: {
configFile: './.eslintrc',
fix: true,
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
// new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin( {
'process.env': {
NODE_ENV: JSON.stringify( 'development' ),
BROWSER: JSON.stringify( true ),
},
} ),
new WebpackErrorNotificationPlugin(),
new webpack.optimize.CommonsChunkPlugin( { name: 'common', } ),
],
}
export default config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment