diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..85263e82b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:8-alpine + +WORKDIR /code/ + +EXPOSE 3000 3001 + +COPY . . + +RUN npm install --unsafe-perm + +RUN npm run setup + +ENTRYPOINT npm start diff --git a/Dockerfile-prod b/Dockerfile-prod new file mode 100644 index 000000000..efb1b6ce6 --- /dev/null +++ b/Dockerfile-prod @@ -0,0 +1,11 @@ +FROM node:8-alpine + +WORKDIR /code/ + +EXPOSE 4000 4001 + +COPY . . + +RUN npm run setup + +ENTRYPOINT npm run build diff --git a/README.md b/README.md index 94662db03..b9d64205b 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,20 @@ This will run the automated build process, start up a webserver, and open the ap * **Install [Python 2.7](https://www.python.org/downloads/)**. Some node modules may rely on node-gyp, which requires Python on Windows. * **Install C++ Compiler**. Browser-sync requires a C++ compiler on Windows. [Visual Studio Express](https://www.visualstudio.com/en-US/products/visual-studio-express-vs) comes bundled with a free C++ compiler. Or, if you already have Visual Studio installed: Open Visual Studio and go to File -> New -> Project -> Visual C++ -> Install Visual C++ Tools for Windows Desktop. The C++ compiler is used to compile browser-sync (and perhaps other Node modules). +**Try It Out With [Docker](https://www.docker.com/):** + +* **Run the image.** `docker run -p 4000:4000 -p 4001:4001 -d docker.io/allthethings/react-slingshot` + +**Develop With Docker (including hot reloading on `src` directory)** + +* **Build the image.** `docker build -t react-slingshot .` +* **Run the image with an interactive shell and automatic removal.** + - `docker run -v "$(pwd)"/src:/code/src -p 3000:3000 -p 3001:3001 --name react-slingshot -it --rm react-slingshot` +* **Or run the image in daemon mode.** + - `docker run -v "$(pwd)"/src:/code/src -p 3000:3000 -p 3001:3001 --name react-slingshot -d react-slingshot` + - remove with `docker rm -f react-slingshot` + - print and follow the container's logs with `docker logs --follow react-slingshot` + ## Having Issues? Try these things first. 1. Make sure you ran all steps in [Get started](https://github.com/coryhouse/react-slingshot/blob/master/README.md#get-started) including the [initial machine setup](https://github.com/coryhouse/react-slingshot#initial-machine-setup). 2. Run `npm install` - If you forget to do this, you'll see this: `babel-node: command not found`.