diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..35df0a2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:8-alpine as builder + +WORKDIR /code/ + +EXPOSE 3000 + +COPY . . + +RUN npm install + +ENTRYPOINT npm run start diff --git a/Dockerfile-prod b/Dockerfile-prod new file mode 100644 index 0000000..dc0d146 --- /dev/null +++ b/Dockerfile-prod @@ -0,0 +1,18 @@ +FROM node:8-alpine as builder + +WORKDIR /code/ + +EXPOSE 3000 + +COPY . . + +RUN npm install --unsafe-perm + +RUN npm run build + + +FROM nginx + +WORKDIR /usr/share/nginx/html + +COPY --from=builder /code/build . diff --git a/README.md b/README.md index 66110e2..abcdaa2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Auth with React Router V4 and Firebase V3 This is an example repo for authenticating with Firebase and React Router. +For more info, visit [Protected routes and authentication with React Router v4](https://tylermcginnis.com/react-router-protected-routes-authentication/) + *Using React 15.4.0, React Router 4, and Firebase 3.6.1* #### Features: @@ -15,3 +17,8 @@ This is an example repo for authenticating with Firebase and React Router. * ```npm install``` * ```npm start``` * Visit ```localhost:3000``` + +#### Try it out in a [Docker](https://www.docker.com/) container: +* Run a container running the prod version: `docker run -p 8080:80 -d allthethings/react-router-firebase-auth` +* **Or** build a dev version, locally: `docker build -t react-router-firebase-auth .` +* Then run the image (listens for changes to src): `docker run -v "$(pwd)/src:/code/src" -p 3000:3000 -d --name react-router-firebase-auth react-router-firebase-auth`