Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding docker support #522

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions Dockerfile-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:8-alpine

WORKDIR /code/

EXPOSE 4000 4001

COPY . .

RUN npm run setup

ENTRYPOINT npm run build
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down