Coder Social home page Coder Social logo

docker-webpack's Introduction

jmfirth/docker-webpack

Webpack-based development and build toolchain in a container

Develop and build JavaScript applications using webpack and webpack-dev-server with ease! Get all the bells and whistles of modern Node.js and/or web application development without the hassle of installing an environment.

Available Images

This image uses the official Node.js image on the Docker Hub as it's base, following their tag convention. Below is a list of currently available tags:

Tags Environment
latest Node.js latest on Debian Jessie
7 Node.js 7 latest on Debian Jessie
6 Node.js 6 latest on Debian Jessie
4 Node.js 4 latest on Debian Jessie
wheezy Node.js latest on Debian Wheezy
slim Node.js latest on Debian Jessie
7-wheezy Node.js 7 latest on Debian Wheezy
7-slim Node.js 7 latest on Debian Jessie
6-wheezy Node.js 6 latest on Debian Wheezy
6-slim Node.js 6 latest on Debian Jessie
4-wheezy Node.js 4 latest on Debian Wheezy
4-slim Node.js 4 latest on Debian Jessie

Installing the Image

Install latest:

$ docker pull jmfirth/webpack

Running the Image

The image preinstalls webpack and webpack-dev-server for use in the interactive docker shell. Any valid webpack and webpack-dev-server command can be run.

Example: Install Npm Dependencies

An example of installing project npm dependencies.

Note: Assumes that project.json exists at source root. Note: Yarn is also available globally if you prefer!

$ docker run \
  --rm \
  -i \
  -t \
  -v /path/to/source:/app \
  jmfirth/webpack \
  npm install --no-bin-links

Example: Watch and Serve

An example of watching and serving the app using webpack-dev-server.

Note: Assumes that default webpack.config.js exists at source root.

$ docker run \
  --rm \
  -i \
  -t \
  -v /path/to/source:/app \
  -p 3000:8080 \
  jmfirth/webpack \
  webpack-dev-server --hot --inline --progress --host 0.0.0.0

Example: Build

An example of building the app with webpack.

Note: Assumes that default webpack.config.js exists at source root.

$ docker run \
  --rm \
  -i \
  -t \
  -v /path/to/source:/app \
  jmfirth/webpack \
  webpack

Full Example

Create a docker machine:

# create a docker machine called "site"
$ docker-machine create site --driver=virtualbox

# get environment variables to new vm
$ eval "$(docker-machine env site)"

Obtain and prepare source:

# get some source that uses webpack
$ git clone https://github.com/petehunt/react-webpack-template.git src
$ cd src

# install npm dependencies
$ docker run \
  --rm \
  -i \
  -t \
  -v /path/to/src:/app \
  jmfirth/webpack \
  npm install --no-bin-links

Modify the webpack.config.js file to watch by polling:

watchOptions: {
   poll: true
}

Serve the app:

# serve app through webpack-dev-server
$ docker run \
  --rm \
  -i \
  -t \
  -v /path/to/src:/app \
  -p 3000:8080 \
  jmfirth/webpack \
  webpack-dev-server --hot --inline --progress --host 0.0.0.0

docker-webpack's People

Contributors

jmfirth avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.