Skip to content
This repository has been archived by the owner on Jun 12, 2019. It is now read-only.

Docker support #64

Open
wants to merge 3 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
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/dist

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:8.9.4-alpine

# Slack clone is based at the root dir
WORKDIR /slack-clone

# Copy package.json and install dependencies
# - we do this first to take advantage of caching
# ARG NPM_TOKEN
# COPY ./.npmrc /slack-clone/.npmrc
COPY ./package.json /slack-clone/package.json
COPY ./package-lock.json /slack-clone/package-lock.json
# COPY ./yarn.lock /slack-clone/yarn.lock

RUN ["npm", "install"]

# Copy the client-side of the app over and trigger the build.
COPY ./ /slack-clone
ENV NODE_ENV production

# build static assets (stored in `/dist`)
RUN ["npm", "run", "heroku-postbuild"]

ENTRYPOINT [ "npm" ]
CMD [ "start" ]
61 changes: 48 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Slack clone - A real time chat service
======================================

** I'm not going to actively maintain this repo anymore (since Feb 2017), but feel free to fork the project or create PRs **

Possible future improvements:
Expand All @@ -15,57 +18,89 @@ Possible future improvements:

[![Build Status](https://travis-ci.org/avrj/slack-clone.svg?branch=master)](https://travis-ci.org/avrj/slack-clone) [![codecov](https://codecov.io/gh/avrj/slack-clone/branch/master/graph/badge.svg?token=ettfcfGuOA)](https://codecov.io/gh/avrj/slack-clone)

# Slack clone - A real time chat service
Demo: https://zh47.herokuapp.com
Demo: [https://zh47.herokuapp.com](https://zh47.herokuapp.com)

Stack:

- React
- Socket.io
- Express
- Node.js
- MongoDB
- Docker (optional)

I didn't use any state container (like Redux) yet, but it might be useful in the future to avoid passing data between components.

## User stories
User stories
------------

- Users can choose a nickname
- Users can join chatrooms of their own choosing
- Users can send messages to other users

## Features
Features
--------

- Mobile-friendly UI (Material-UI)
- Stores messages on the server (only messages from channels are saved at the moment, but it's quite easy to extend it to support private messages also)
- Supports multiple logged clients at the same time from one user (e.g. desktop & mobile clients)
- Authentication is made with Passport.js which makes other sign up methods easy to implement (e.g. Facebook OAuth)
- Highlights unread conversations
- Keeps list of online users in real time

## Install & run
Install & run
-------------

The server includes webpack-dev-middleware & webpack-hot-middleware to show code changes on browser without refreshing

```
```bash
yarn
yarn start
```

## Testing (Mocha & Chai)
Most of the real time and routes api are covered in the tests.
Also, docker:

```bash
docker build --tag slack-clone .
docker run \
--interactive \
--tty \
--name slack-clone \
--rm \
--publish 3000:3000/tcp \
--expose 3000/tcp \
--link mongo \
--env 'MONGODB_URI=mongodb://mongo/chat_dev' \
slack-clone:latest
```

Testing (Mocha & Chai)
--------

Most of the real time and routes api are covered in the tests.

```bash
yarn test
```

## Coverage report (Istanbul)
Coverage report (Istanbul)
--------

Coverage report can be generated by running
```

```bash
yarn coverage
```

## Linting (ESlint)
```
Linting (ESlint)
--------

```bash
yarn lint
```

to fix most of the warnings automatically:
```

```bash
yarn lint:fix
```